diff options
author | maxime50 <[email protected]> | 2021-07-04 18:22:10 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-04 18:22:10 -0400 |
commit | d2324d14e166a17b2573006485fd3e4e8c971100 (patch) | |
tree | 2b1426f0ef6fa1eb82514856e6be739c755990d1 /lua/lsp/init.lua | |
parent | f93c00796281a9620c3f3714cf4129be80d80e89 (diff) |
Better JS/TS Development Experience (#667)
Co-authored-by: Maxime <[email protected]>
Diffstat (limited to 'lua/lsp/init.lua')
-rw-r--r-- | lua/lsp/init.lua | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 8bc8984f..7c78d054 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -106,8 +106,48 @@ if O.document_highlight then end function lsp_config.tsserver_on_attach(client, bufnr) - lsp_config.common_on_attach(client, bufnr) + -- lsp_config.common_on_attach(client, bufnr) client.resolved_capabilities.document_formatting = false + + local ts_utils = require("nvim-lsp-ts-utils") + + -- defaults + ts_utils.setup { + debug = false, + disable_commands = false, + enable_import_on_completion = false, + import_all_timeout = 5000, -- ms + + -- eslint + eslint_enable_code_actions = true, + eslint_enable_disable_comments = true, + eslint_bin = O.lang.tsserver.linter, + eslint_config_fallback = nil, + eslint_enable_diagnostics = true, + + -- formatting + enable_formatting = O.lang.tsserver.autoformat, + formatter = O.lang.tsserver.formatter, + formatter_config_fallback = nil, + + -- parentheses completion + complete_parens = false, + signature_help_in_parens = false, + + -- update imports on file move + update_imports_on_move = false, + require_confirmation_on_move = false, + watch_dir = nil, + } + + -- required to fix code action ranges + ts_utils.setup_client(client) + + -- TODO: keymap these? + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", {silent = true}) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", {silent = true}) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", ":TSLspRenameFile<CR>", {silent = true}) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":TSLspImportAll<CR>", {silent = true}) end |