tree-sitter / tree-sitter

An incremental parsing system for programming tools

Home Page:https://tree-sitter.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nvim tree-sitter prompts every step of the way during update

xeon826 opened this issue · comments

Problem

When I run :PackerUpdate tree-sitter will proceed to download and compile the syntax highlighting packages for every language it knows of. I don't use the majority of these languages and I don't think I ever will. Also it gives me a prompt after every step it takes during the process

Press ENTER or type command to continue
Downloading tree-sitter-luau...
Press ENTER or type command to continue
Creating temporary directory
Press ENTER or type command to continue
Extracting tree-sitter-luau...
Press ENTER or type command to continue
Compiling...
Press ENTER or type command to continue
Treesitter parser for luau has been installed
Press ENTER or type command to continue
Downloading tree-sitter-markdown...
Press ENTER or type command to continue
Creating temporary directory
Press ENTER or type command to continue
Extracting tree-sitter-markdown...
Press ENTER or type command to continue
Compiling...
Press ENTER or type command to continue
Treesitter parser for markdown has been installed
Press ENTER or type command to continue
Downloading tree-sitter-markdown_inline...
Press ENTER or type command to continue
Creating temporary directory
Press ENTER or type command to continue
Extracting tree-sitter-markdown_inline...
Press ENTER or type command to continue
Compiling...
Press ENTER or type command to continue
Treesitter parser for markdown_inline has been installed
Press ENTER or type command to continue
Downloading tree-sitter-matlab...
Press ENTER or type command to continue
Creating temporary directory
Press ENTER or type command to continue
Extracting tree-sitter-matlab...
Press ENTER or type command to continue
Compiling...
Press ENTER or type command to continue
Treesitter parser for matlab has been installed
Press ENTER or type command to continue
Downloading tree-sitter-mermaid...
Press ENTER or type command to continue
Creating temporary directory
Press ENTER or type command to continue
Extracting tree-sitter-mermaid...
Press ENTER or type command to continue
Compiling...
Press ENTER or type command to continue
Treesitter parser for mermaid has been installed
Press ENTER or type command to continue
Downloading tree-sitter-meson...
Press ENTER or type command to continue
Creating temporary directory
Press ENTER or type command to continue
Extracting tree-sitter-meson...
Press ENTER or type command to continue
Compiling...
Press ENTER or type command to continue
Treesitter parser for meson has been installed
Press ENTER or type command to continue

Which is just a snippet, I have this in my initialization for the plugin:

require'nvim-treesitter.configs'.setup {
  -- A list of parser names, or "all" (the five listed parsers should always be installed)
  ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "python", "typescript" },

  -- Install parsers synchronously (only applied to `ensure_installed`)
  sync_install = false,

  -- Automatically install missing parsers when entering buffer
  -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
  auto_install = true,

  -- List of parsers to ignore installing (for "all")
  -- ignore_install = { "javascript" },

  ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
  -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!

  highlight = {
    enable = true,

    -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
    -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
    -- the name of the parser)
    -- list of language that will be disabled
    disable = { "c", "rust" },
    -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
    disable = function(lang, buf)
        local max_filesize = 2000 * 1024 -- 2 MB
        local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
        if ok and stats and stats.size > max_filesize then
            return true
        end
    end,

    -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
    -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
    -- Using this option may slow down your editor, and you may see some duplicate highlights.
    -- Instead of true it can also be a list of languages
    additional_vim_regex_highlighting = false,
  },
}
vim.treesitter.language.register('python', 'python')

And so I would think it would only download and install the respective missing syntax highlighting for the language when it encounters it, other than those few languages listed where it should download them before-hand.

It's fine to download and install the syntax highlighting packages for every language although unnecessary but I don't like that it gives me a prompt every step of the way. I eventually had to Ctrl + C out of it and reload nvim.

Steps to reproduce

  1. Install nvim and package plugin manager
  2. Install tree-sitter plugin with :PackerInstall
  3. Run :PackerUpdate
  4. Note that it's prompting every step of the way during update.

Expected behavior

It should just download and install all of the necessary packages it needs without me giving me a prompt after every step of the way.

Tree-sitter version (tree-sitter --version)

I'm on commit aa31b8d4ccaa05e1ab30120e103f72adbd2837bc

Operating system/version

Ubuntu 22.04

Wrong repo

May be this repository is better for this report?