diff options
author | Chris <[email protected]> | 2021-03-18 23:47:03 -0400 |
---|---|---|
committer | Chris <[email protected]> | 2021-03-18 23:47:03 -0400 |
commit | 7eea23bb6c2449675a11f762838a8656d5de0f62 (patch) | |
tree | 0050dbc21797aa592cd93d306cbc644a04a8ed2a /lua/lsp/init.lua | |
parent | b3f2348d97bdc85304e65f3f6cb8e272f4b674fb (diff) |
prettier and eslint configured
Diffstat (limited to 'lua/lsp/init.lua')
-rw-r--r-- | lua/lsp/init.lua | 45 |
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 |