nvim: plugins/lsp: Drop nvim-lsp-ts-utils

The plugin is in maintenance mode and typescript.nvim does not support
inlay hints. We already use eslint language server and extra commands
provided by lsp-ts-utils/typescript.nvim is something we have never
used. Just drop it.
This commit is contained in:
Sanchayan Maity 2022-05-02 10:34:44 +05:30
parent 59b1696ffa
commit 211cd39138
2 changed files with 2 additions and 37 deletions

View file

@ -1,6 +1,5 @@
local nvim_lsp = require 'lspconfig' local nvim_lsp = require 'lspconfig'
local protocol = require 'vim.lsp.protocol' local protocol = require 'vim.lsp.protocol'
local ts_utils = require 'nvim-lsp-ts-utils'
local util = require 'lspconfig/util' local util = require 'lspconfig/util'
local lightbulb = require 'nvim-lightbulb' local lightbulb = require 'nvim-lightbulb'
@ -80,43 +79,11 @@ local lsp_key_mappings = {
{ "codeActionProvider", 'v', '<Leader>r', '<cmd>lua vim.lsp.buf.range_code_action{only = \'refactor\'}<CR>' }, { "codeActionProvider", 'v', '<Leader>r', '<cmd>lua vim.lsp.buf.range_code_action{only = \'refactor\'}<CR>' },
} }
local ts_utils_setup = function(client, bufnr, opts) local tsserver_setup = function(client)
if client.name == 'tsserver' then if client.name == 'tsserver' then
-- Disable tsserver formatting, we want formatting via prettier -- Disable tsserver formatting, we want formatting via prettier
client.server_capabilities.documentFormattingProvider = false client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false client.server_capabilities.documentRangeFormattingProvider = false
ts_utils.setup {
debug = false,
disable_commands = false,
enable_import_on_completion = false,
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
},
update_imports_on_move = false,
require_confirmation_on_move = false,
watch_dir = nil,
filter_out_diagnostics_by_severity = {},
filter_out_diagnostics_by_code = {},
auto_inlay_hints = true,
inlay_hints_highlight = "Hint",
}
ts_utils.setup_client(client)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', ':TSLspOrganize<CR>' , opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gf', ':TSLspFixCurrent<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gI', ':TSLspImportAll<CR>' , opts)
end end
end end
@ -133,7 +100,7 @@ local on_attach = function(client, bufnr)
-- This needs to be here, so we disable formatting with tsserver before -- This needs to be here, so we disable formatting with tsserver before
-- actually checking it below. -- actually checking it below.
ts_utils_setup(client, bufnr, opts) tsserver_setup(client)
for _, mappings in pairs(lsp_key_mappings) do for _, mappings in pairs(lsp_key_mappings) do
local capability, mode, lhs, rhs = unpack(mappings) local capability, mode, lhs, rhs = unpack(mappings)
@ -274,7 +241,6 @@ nvim_lsp.jedi_language_server.setup {
require('rust-tools').setup(rust_tool_opts) require('rust-tools').setup(rust_tool_opts)
nvim_lsp.tsserver.setup { nvim_lsp.tsserver.setup {
init_options = require("nvim-lsp-ts-utils").init_options,
on_init = on_init, on_init = on_init,
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,

View file

@ -63,7 +63,6 @@ local init = function ()
-- Alignment -- Alignment
use 'junegunn/vim-easy-align' use 'junegunn/vim-easy-align'
use 'nvim-lua/plenary.nvim' use 'nvim-lua/plenary.nvim'
use 'jose-elias-alvarez/nvim-lsp-ts-utils'
-- LSP -- LSP
use { use {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',