Compare commits

...

2 Commits

Author SHA1 Message Date
Ori Perry
1f4c21f463 Don't extend lsp capabilities because blink does it internally 2026-02-27 23:27:25 +02:00
Ori Perry
4021496050 Add treesitter indentation 2026-02-27 22:56:57 +02:00

View File

@ -598,12 +598,6 @@ require('lazy').setup({
end, end,
}) })
-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
local capabilities = require('blink.cmp').get_lsp_capabilities()
-- Enable the following language servers -- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
-- See `:help lsp-config` for information about keys and how to configure -- See `:help lsp-config` for information about keys and how to configure
@ -667,7 +661,6 @@ require('lazy').setup({
require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-tool-installer').setup { ensure_installed = ensure_installed }
for name, server in pairs(servers) do for name, server in pairs(servers) do
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
vim.lsp.config(name, server) vim.lsp.config(name, server)
vim.lsp.enable(name) vim.lsp.enable(name)
end end
@ -882,6 +875,7 @@ require('lazy').setup({
lazy = false, lazy = false,
build = ':TSUpdate', build = ':TSUpdate',
branch = 'main', branch = 'main',
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
config = function() config = function()
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
require('nvim-treesitter').install(parsers) require('nvim-treesitter').install(parsers)
@ -890,9 +884,20 @@ require('lazy').setup({
local buf, filetype = args.buf, args.match local buf, filetype = args.buf, args.match
local language = vim.treesitter.language.get_lang(filetype) local language = vim.treesitter.language.get_lang(filetype)
if not vim.tbl_contains(parsers, language) then return end if not language then return end
vim.treesitter.start() -- check if parser exists and load it
if not vim.treesitter.language.add(language) then return end
-- enables syntax highlighting and other treesitter features
vim.treesitter.start(buf, language)
-- enables treesitter based folds
-- for more info on folds see `:help folds`
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
-- vim.wo.foldmethod = 'expr'
-- enables treesitter based indentation
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end, end,
}) })
end, end,