migration to 0.12 complete

This commit is contained in:
Zoty 2026-04-13 16:03:54 -03:00
parent 94fedd08d5
commit bf3e4855b9
Signed by: Zoty
SSH key fingerprint: SHA256:WsGEGivgl37t3Mth6uugXMOgMCTR7QolIepNbC+j/tA
2 changed files with 30 additions and 8 deletions

View file

@ -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

View file

@ -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,
}