nvimrc: add basic tsserver setup

This commit is contained in:
Rob Watson 2021-10-08 14:30:42 +02:00
parent 9f65809479
commit 9fb1a834d6
1 changed files with 40 additions and 0 deletions

40
nvimrc
View File

@ -632,6 +632,46 @@ nvim_lsp.solargraph.setup{
on_attach = on_attach, on_attach = on_attach,
} }
-- Typescript
-- https://jose-elias-alvarez.medium.com/configuring-neovims-lsp-client-for-typescript-development-5789d58ea9c
nvim_lsp.tsserver.setup{
on_attach = on_attach,
}
local filetypes = {
typescript = "eslint",
typescriptreact = "eslint",
}
local linters = {
eslint = {
sourceName = "eslint",
command = "eslint",
rootPatterns = {".eslintrc.js", "package.json"},
debounce = 100,
args = {"--stdin", "--stdin-filename", "%filepath", "--format", "json"},
parseJson = {
errorsRoot = "[0].messages",
line = "line",
column = "column",
endLine = "endLine",
endColumn = "endColumn",
message = "${message} [${ruleId}]",
security = "severity"
},
securities = {[1] = "error", [2] = "warning"}
}
}
nvim_lsp.diagnosticls.setup{
on_attach = on_attach,
filetypes = vim.tbl_keys(filetypes),
init_options = {
linters = linters,
filetypes = filetypes,
}
}
-- Lua -- Lua
local system_name local system_name