refinement of LSP options and vim packages for TS/JS development
This commit is contained in:
parent
0002f2e51e
commit
f9cdfb390f
3 changed files with 99 additions and 24 deletions
|
|
@ -53,7 +53,77 @@ local on_attach = function(client, bufnr)
|
|||
end
|
||||
|
||||
nvim_lsp.diagnosticls.setup {
|
||||
on_attach = on_attach
|
||||
on_attach = on_attach;
|
||||
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'css', 'scss', 'markdown', 'pandoc' },
|
||||
init_options = {
|
||||
linters = {
|
||||
eslint = {
|
||||
command = 'eslint',
|
||||
rootPatterns = { '.git' },
|
||||
debounce = 100,
|
||||
args = { '--stdin', '--stdin-filename', '%filepath', '--format', 'json' },
|
||||
sourceName = 'eslint',
|
||||
parseJson = {
|
||||
errorsRoot = '[0].messages',
|
||||
line = 'line',
|
||||
column = 'column',
|
||||
endLine = 'endLine',
|
||||
endColumn = 'endColumn',
|
||||
message = '[eslint] ${message} [${ruleId}]',
|
||||
security = 'severity'
|
||||
},
|
||||
securities = {
|
||||
[2] = 'error',
|
||||
[1] = 'warning'
|
||||
}
|
||||
},
|
||||
markdownlint = {
|
||||
command = 'markdownlint',
|
||||
rootPatterns = { '.git' },
|
||||
isStderr = true,
|
||||
debounce = 100,
|
||||
args = { '--stdin' },
|
||||
offsetLine = 0,
|
||||
offsetColumn = 0,
|
||||
sourceName = 'markdownlint',
|
||||
securities = {
|
||||
undefined = 'hint'
|
||||
},
|
||||
formatLines = 1,
|
||||
formatPattern = {
|
||||
'^.*:(\\d+)\\s+(.*)$',
|
||||
{
|
||||
line = 1,
|
||||
column = -1,
|
||||
message = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
filetypes = {
|
||||
javascript = 'eslint',
|
||||
javascriptreact = 'eslint',
|
||||
typescript = 'eslint',
|
||||
typescriptreact = 'eslint',
|
||||
markdown = 'markdownlint',
|
||||
pandoc = 'markdownlint'
|
||||
},
|
||||
formatters = {
|
||||
prettier = {
|
||||
command = 'prettier',
|
||||
args = { '--stdin-filepath', '%filename' }
|
||||
}
|
||||
},
|
||||
formatFiletypes = {
|
||||
css = 'prettier',
|
||||
javascript = 'prettier',
|
||||
javascriptreact = 'prettier',
|
||||
json = 'prettier',
|
||||
scss = 'prettier',
|
||||
typescript = 'prettier',
|
||||
typescriptreact = 'prettier'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nvim_lsp.elmls.setup{
|
||||
|
|
@ -61,7 +131,7 @@ nvim_lsp.elmls.setup{
|
|||
}
|
||||
nvim_lsp.tsserver.setup {
|
||||
on_attach = function(client)
|
||||
-- Avoid conflict with prettier
|
||||
-- Avoid conflict with prettier and eslint
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
on_attach(client)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue