migration to 0.12 complete
This commit is contained in:
parent
94fedd08d5
commit
bf3e4855b9
2 changed files with 30 additions and 8 deletions
2
init.lua
2
init.lua
|
|
@ -25,7 +25,7 @@ vim.lsp.enable({
|
|||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(ev)
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
if client and client.supports_method('textDocument/inlayHint') then
|
||||
if client and client:supports_method('textDocument/inlayHint') then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = ev.buf })
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
branch = 'main',
|
||||
build = ':TSUpdate',
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
config = function()
|
||||
local ts = require('nvim-treesitter')
|
||||
|
||||
local parsers = {
|
||||
'lua',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'rust',
|
||||
'typescript',
|
||||
'tsx',
|
||||
'javascript',
|
||||
'jsx',
|
||||
'html',
|
||||
'css',
|
||||
'scss',
|
||||
|
|
@ -27,9 +32,26 @@ return {
|
|||
'astro',
|
||||
'vue',
|
||||
'java',
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
},
|
||||
}
|
||||
|
||||
for _, parser in ipairs(parsers) do
|
||||
ts.install(parser)
|
||||
end
|
||||
|
||||
-- Filetypes whose name differs from the parser name
|
||||
local ft_to_parser = {
|
||||
typescriptreact = 'tsx',
|
||||
javascriptreact = 'jsx',
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
callback = function(ev)
|
||||
local ft = ev.match
|
||||
local lang = ft_to_parser[ft] or ft
|
||||
if pcall(vim.treesitter.start, ev.buf, lang) then
|
||||
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue