Skip to content

feat: use ts-install.nvim to automatically install treesitter parsers#1953

Closed
tpwo wants to merge 3 commits intonvim-lua:masterfrom
tpwo:add-ts-install
Closed

feat: use ts-install.nvim to automatically install treesitter parsers#1953
tpwo wants to merge 3 commits intonvim-lua:masterfrom
tpwo:add-ts-install

Conversation

@tpwo
Copy link

@tpwo tpwo commented Mar 19, 2026

Resolves #1951.

jgw6fg8qng-ai

This comment was marked as spam.

init.lua Outdated
dependencies = { 'nvim-treesitter/nvim-treesitter' },
config = function()
require('ts-install').setup {
ensure_install = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
Copy link

@Christoph-Raab Christoph-Raab Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be a merge of an array with those defaults and an empty array where one can configure custom parsers?

That would simplify configuring custom parsers with less possibility for merge conflicts.

Something like

local my_parsers = {}
local default_parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }

require('ts-install').setup {
  ensure_install = vim.list_extend(my_parsers, default_parsers),
  auto_install = true,
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I noticed that similar approach is used for Mason's ensure_installed, and I replicated that approach:

kickstart.nvim/init.lua

Lines 653 to 658 in 0619d89

local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
-- You can add other tools here that you want Mason to install
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }

@tpwo
Copy link
Author

tpwo commented Mar 23, 2026

Closing this PR, as #1956 implements the same behavior without relying on a new plugin.

@tpwo tpwo closed this Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically install treesitter parsers with ts-install.nvim

3 participants