Add denols to nvim
In Deno projects `tsserver` is less than ideal. This PR starts `denols` instead of `tsserver` if `nvim` finds the `NVIM_USE_DENOLS` variable when reading the lsp config.
This commit is contained in:
parent
4c7fed14f0
commit
34cc7d40f2
|
@ -80,6 +80,8 @@ lua <<EOF
|
|||
-- vscode HTML lsp needs this https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#html
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
local use_denols_for_typescript = not(os.getenv('NVIM_USE_DENOLS') == nil)
|
||||
|
||||
for lsp_key, lsp_settings in pairs({
|
||||
'bashls', ------------------------------- Bash
|
||||
'ccls', --------------------------------- C / C++ / Objective-C
|
||||
|
@ -121,7 +123,13 @@ lua <<EOF
|
|||
['terraformls'] = { --------------------- Terraform
|
||||
['filetypes'] = { "terraform", "hcl", "tf" }
|
||||
},
|
||||
'tsserver', ----------------------------- Typescript / JavaScript
|
||||
|
||||
-- The TS/JS server is chosen depending on an environment variable,
|
||||
-- since denols is nicer for Deno based projects
|
||||
------------------------ Deno TS/JS
|
||||
------------------------------------ Typescript / JavaScript
|
||||
(use_denols_for_typescript and 'denols' or 'tsserver'),
|
||||
|
||||
'vuels', -------------------------------- Vue
|
||||
'svelte', ------------------------------- Svelte
|
||||
['yamlls'] = { -------------------------- YAML
|
||||
|
@ -212,21 +220,26 @@ lua <<EOF
|
|||
},
|
||||
}
|
||||
|
||||
-- Configure diagnostics
|
||||
vim.diagnostic.config({
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#denols
|
||||
vim.g.markdown_fenced_languages = {
|
||||
"ts=typescript"
|
||||
}
|
||||
|
||||
-- Configure diagnostics
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = false,
|
||||
})
|
||||
})
|
||||
|
||||
-- Change diagnostic symbols in the sign column (gutter)
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
-- Change diagnostic symbols in the sign column (gutter)
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
end
|
||||
EOF
|
||||
|
||||
" have a fixed column for the diagnostics to appear in
|
||||
|
|
Loading…
Reference in a new issue