19 lines
573 B
Lua
19 lines
573 B
Lua
vim.api.nvim_create_autocmd('LspAttach', {
|
|
callback = function(args)
|
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
|
|
|
if not client then
|
|
return
|
|
end
|
|
|
|
-- Prefer LSP folding if client supports it
|
|
if client:supports_method('textDocument/foldingRange') then
|
|
local win = vim.api.nvim_get_current_win()
|
|
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
|
end
|
|
|
|
if client:supports_method 'textDocument/completion' then
|
|
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
|
end
|
|
end,
|
|
})
|