mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2026-03-30 01:31:30 +00:00
parent
8ac4b12632
commit
e01e1eb8f8
13
init.lua
13
init.lua
@ -903,7 +903,18 @@ require('lazy').setup({
|
|||||||
local language = vim.treesitter.language.get_lang(filetype)
|
local language = vim.treesitter.language.get_lang(filetype)
|
||||||
if not language then return end
|
if not language then return end
|
||||||
|
|
||||||
treesitter_try_attach(buf, language)
|
local installed_parsers = require('nvim-treesitter').get_installed 'parsers'
|
||||||
|
|
||||||
|
if vim.tbl_contains(installed_parsers, language) then
|
||||||
|
-- enable the parser if it is installed
|
||||||
|
treesitter_try_attach(buf, language)
|
||||||
|
elseif vim.tbl_contains(available_parsers, language) then
|
||||||
|
-- if a parser is available in `nvim-treesitter` auto install it, and enable it after the installation is done
|
||||||
|
require('nvim-treesitter').install(language):await(function() treesitter_try_attach(buf, language) end)
|
||||||
|
else
|
||||||
|
-- try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
|
||||||
|
treesitter_try_attach(buf, language)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user