nvim: lsp: Sync nvim-lsp-ts-utils configuration with upstream

This commit is contained in:
Sanchayan Maity 2021-07-21 11:00:40 +05:30
parent d00bf90b30
commit 3e7fd609ec
1 changed files with 22 additions and 10 deletions

View File

@ -123,31 +123,37 @@ local on_attach = function(client, bufnr)
}
if client.name == 'tsserver' then
null_ls.setup {}
-- Disable tsserver formatting as we plan on formatting via null-ls
client.resolved_capabilities.document_formatting = false
ts_utils.setup {
debug = false,
disable_commands = false,
enable_import_on_completion = false,
import_on_completion_timeout = 5000,
import_all_timeout = 5000,
import_all_scan_buffers = 100,
import_all_select_source = false,
import_all_priorities = {
buffers = 4, -- loaded buffer names
buffer_content = 3, -- loaded buffer content
local_files = 2, -- git files or files with relative path markers
same_file = 1, -- add to existing import statement
},
eslint_enable_code_actions = true,
eslint_bin = "eslint",
eslint_args = {"-f", "json", "--stdin", "--stdin-filename", "$FILENAME"},
eslint_enable_disable_comments = true,
eslint_enable_diagnostics = true,
eslint_diagnostics_debounce = 250,
eslint_config_fallback = nil,
enable_formatting = true,
formatter = "prettier",
formatter_args = {"--stdin-filepath", "$FILENAME"},
format_on_save = false,
no_save_after_format = false,
complete_parens = true,
signature_help_in_parens = false,
formatter_config_fallback = nil,
update_imports_on_move = false,
require_confirmation_on_move = false,
watch_dir = nil,
}
ts_utils.setup_client(client)
@ -172,6 +178,12 @@ function set_snippet_capabilities()
return capabilities
end
-- This should be called only once, so cannot be in on_attach as earlier.
-- See https://github.com/jose-elias-alvarez/null-ls.nvim/issues/38
-- Required by nvim-lsp-ts-utils to provide ESLint code actions, diagnostics
-- and formatting.
null_ls.setup {}
local servers = { 'hls', 'rust_analyzer', 'pylsp', 'tsserver' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {