summaryrefslogtreecommitdiff
path: root/lua/lsp/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/lsp/init.lua')
-rw-r--r--lua/lsp/init.lua45
1 files changed, 21 insertions, 24 deletions
diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua
index 12ce36a1..9a1bb511 100644
--- a/lua/lsp/init.lua
+++ b/lua/lsp/init.lua
@@ -1,24 +1,12 @@
-- TODO figure out why this don't work
-vim.fn.sign_define("LspDiagnosticsSignError", {
- texthl = "LspDiagnosticsSignError",
- text = "",
- numhl = "LspDiagnosticsSignError"
-})
-vim.fn.sign_define("LspDiagnosticsSignWarning", {
- texthl = "LspDiagnosticsSignWarning",
- text = "",
- numhl = "LspDiagnosticsSignWarning"
-})
-vim.fn.sign_define("LspDiagnosticsSignInformation", {
- texthl = "LspDiagnosticsSignInformation",
- text = "",
- numhl = "LspDiagnosticsSignInformation"
-})
-vim.fn.sign_define("LspDiagnosticsSignHint", {
- texthl = "LspDiagnosticsSignHint",
- text = "",
- numhl = "LspDiagnosticsSignHint"
-})
+vim.fn.sign_define("LspDiagnosticsSignError",
+ {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"})
+vim.fn.sign_define("LspDiagnosticsSignWarning",
+ {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"})
+vim.fn.sign_define("LspDiagnosticsSignInformation",
+ {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"})
+vim.fn.sign_define("LspDiagnosticsSignHint",
+ {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"})
vim.cmd('nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>')
vim.cmd('nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>')
@@ -42,10 +30,7 @@ autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]]
-- Java
-- autocmd FileType java nnoremap ca <Cmd>lua require('jdtls').code_action()<CR>
-local lsp_config = {}
-
-function lsp_config.common_on_attach(client, bufnr)
-
+local function documentHighlight(client, bufnr)
-- Set autocommands conditional on server_capabilities
if client.resolved_capabilities.document_highlight then
vim.api.nvim_exec([[
@@ -58,7 +43,19 @@ function lsp_config.common_on_attach(client, bufnr)
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]], false)
+
end
+
+end
+local lsp_config = {}
+
+function lsp_config.common_on_attach(client, bufnr)
+ documentHighlight(client, bufnr)
+end
+
+function lsp_config.tsserver_on_attach(client, bufnr)
+ lsp_config.common_on_attach(client, bufnr)
+ client.resolved_capabilities.document_formatting = false
end
-- Use a loop to conveniently both setup defined servers