prettier and eslint configured

This commit is contained in:
Chris 2021-03-18 23:47:03 -04:00
parent b3f2348d97
commit 7eea23bb6c
9 changed files with 123 additions and 93 deletions

View file

@ -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