Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:TSInstall not install parsers to parser_install_dir #6657

Closed
fcying opened this issue May 18, 2024 · 2 comments
Closed

:TSInstall not install parsers to parser_install_dir #6657

fcying opened this issue May 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@fcying
Copy link

fcying commented May 18, 2024

Describe the bug

I customized the parser_install_dir folder. When I start nvim for the first time, it automatically downloads the parsers listed in ensure_installed to the parser_install_dir directory. However, when I use TSinstall xxx, it downloads to the plugin directory instead.

config:

        "nvim-treesitter/nvim-treesitter",
        event = "VeryLazy",
        build = ":TSUpdate",
        config = function()
            local parser_install_dir = g.runtime_dir .. "/parsers"
            vim.opt.runtimepath:prepend(parser_install_dir)
            require("nvim-treesitter.configs").setup({
                parser_install_dir = parser_install_dir,
                ensure_installed = {
                    "vim", "vimdoc", "lua", "query",
                    "bash", "regex", "markdown", "markdown_inline",
                    "cpp", "comment"
                },
                sync_install = false,
                auto_install = false,
                ignore_install = {},
                matchup = { enable = true },
                ...
            })
        end

To Reproduce

  1. remove all parsers
  2. nvim --auto install ensure_installed list
  3. TSinstall vue

Expected behavior

all parsers installed to the parser_install_dir

Output of :checkhealth nvim-treesitter

nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `node` found v20.12.2 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (Debian 12.2.0-14) 12.2.0
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "5.15.146.1-microsoft-standard-WSL2",
  sysname = "Linux",
  version = "#1 SMP Thu Jan 11 04:09:03 UTC 2024"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - comment             ✓ . . . .
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - regex               ✓ . . . .
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - vue                 ✓ . ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

Output of nvim --version

0.10

Additional context

No response

@fcying fcying added the bug Something isn't working label May 18, 2024
@clason
Copy link
Contributor

clason commented May 18, 2024

Sorry, we don't support lazy-loading. If you can reproduce this with a minimal config that only uses nvim-treesitter (that I can test with nvim --clean -u test.lua), I will take a look.

@fcying
Copy link
Author

fcying commented May 18, 2024

My mistake. I set up parser_install_dir once when installing nvim-treesitter, and called require("nvim-treesitter.configs").setup() again when installing nvim-treesitter-textobjects(without configuring parser_install_dir). As a result, parser_install_dir became nil. Combining the setups for these two plugins should fix it.

@fcying fcying closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants