summaryrefslogtreecommitdiff
path: root/lua/user/lsp
diff options
context:
space:
mode:
Diffstat (limited to 'lua/user/lsp')
-rw-r--r--lua/user/lsp/handlers.lua33
-rw-r--r--lua/user/lsp/null-ls.lua7
2 files changed, 26 insertions, 14 deletions
diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua
index 5792a74..fc5d7d3 100644
--- a/lua/user/lsp/handlers.lua
+++ b/lua/user/lsp/handlers.lua
@@ -45,19 +45,25 @@ M.setup = function()
end
local function lsp_highlight_document(client)
- -- Set autocommands conditional on server_capabilities
- if client.resolved_capabilities.document_highlight then
- vim.api.nvim_exec(
- [[
- augroup lsp_document_highlight
- autocmd! * <buffer>
- autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
- autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
- augroup END
- ]],
- false
- )
+ -- if client.server_capabilities.document_highlight then
+ local status_ok, illuminate = pcall(require, "illuminate")
+ if not status_ok then
+ return
end
+ illuminate.on_attach(client)
+ -- -- Set autocommands conditional on server_capabilities
+ -- if client.resolved_capabilities.document_highlight then
+ -- vim.api.nvim_exec(
+ -- [[
+ -- augroup lsp_document_highlight
+ -- autocmd! * <buffer>
+ -- autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
+ -- autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
+ -- augroup END
+ -- ]],
+ -- false
+ -- )
+ -- end
end
local function lsp_keymaps(bufnr)
@@ -80,6 +86,9 @@ local function lsp_keymaps(bufnr)
end
M.on_attach = function(client, bufnr)
+ if client.name == "sumneko_lua" then
+ client.resolved_capabilities.document_formatting = false
+ end
if client.name == "tsserver" then
client.resolved_capabilities.document_formatting = false
end
diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua
index cb02d76..731644e 100644
--- a/lua/user/lsp/null-ls.lua
+++ b/lua/user/lsp/null-ls.lua
@@ -1,11 +1,14 @@
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
+if not null_ls_status_ok then
+ return
+end
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
local formatting = null_ls.builtins.formatting
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
local diagnostics = null_ls.builtins.diagnostics
-null_ls.setup({
+null_ls.setup{
debug = false,
sources = {
formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
@@ -13,4 +16,4 @@ null_ls.setup({
formatting.stylua,
diagnostics.flake8
},
-})
+}