Search code examples
neovimtreesitter

How to create the latex tree-parser for neovim?


I'm currently trying to configure my tree-parser for neovim and I don't understand what i have to do to make latex works.

Here is my tree-sitter conf file (using lazy-vim as a plugin manager) :

return {
    "nvim-treesitter/nvim-treesitter",
        build = ":TSUpdate",
        config = function()
            local configs = require("nvim-treesitter.configs")
            configs.setup({
                ensure_installed = {
                    "bash",
                    "c",
                    "cpp",
                    "glsl",
                    "haskell",
                    "hlsl",
                    "latex",
                    "lua",
                    "make",
                    "python",
                    "rust"
                },
                highlight = { enable = true },
                indent = { enable = true },
            })
        end
}

And when i launch nvim again, it says that "tree-sitter is not executable" and "latex needs to be generated from the grammar definitions" which doesn't really help me.

I went on the git repo of the latex tree-sitter (https://github.com/latex-lsp/tree-sitter-latex) and it says : "To generate the parser, run npx tree-sitter generate after checking out the repository."

I sincerely don't understand what it means. I tried looking around on internet : nothing. I installed npm and tried to install the latex tree-sitter with it : didn't work. I ran the command as they said : error no target.

I don't know what to do now...


Solution

  • Thanks to @MonsieurMerso, i found the problem.

    I didn't know for the :checkhealth command (yeah, complete newbie, started nvim config 3 days ago) and found that a lot of things were indicated here.

    Thus i understood that i needed to EXTERNALLY install the package Tree-sitter (which was already installed) AND tree-sitter-cli which was not.

    Now, everything's working fine, thank you !