~sanchayanmaity/dotfiles

211cd39138b031ea05e5e416d4bebe65708f29c0 — Sanchayan Maity 2 months ago 59b1696
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.
2 files changed, 2 insertions(+), 37 deletions(-)

M nvim/.config/nvim/lua/lsp.lua
M nvim/.config/nvim/lua/plugins.lua
M nvim/.config/nvim/lua/lsp.lua => nvim/.config/nvim/lua/lsp.lua +2 -36
@@ 1,6 1,5 @@
local nvim_lsp   = require 'lspconfig'
local protocol   = require 'vim.lsp.protocol'
local ts_utils   = require 'nvim-lsp-ts-utils'
local util       = require 'lspconfig/util'
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>' },
}

local ts_utils_setup = function(client, bufnr, opts)
local tsserver_setup = function(client)
  if client.name == 'tsserver' then
    -- Disable tsserver formatting, we want formatting via prettier
    client.server_capabilities.documentFormattingProvider      = 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



@@ 133,7 100,7 @@ local on_attach = function(client, bufnr)

  -- This needs to be here, so we disable formatting with tsserver before
  -- actually checking it below.
  ts_utils_setup(client, bufnr, opts)
  tsserver_setup(client)

  for _, mappings in pairs(lsp_key_mappings) do
    local capability, mode, lhs, rhs = unpack(mappings)


@@ 274,7 241,6 @@ nvim_lsp.jedi_language_server.setup {
require('rust-tools').setup(rust_tool_opts)

nvim_lsp.tsserver.setup {
  init_options = require("nvim-lsp-ts-utils").init_options,
  on_init      = on_init,
  on_attach    = on_attach,
  capabilities = capabilities,

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