Browse Source

nixpkgs/neovim: update nvim-lspconfig and remove upstreamed code

Thomas Dy 1 month ago
parent
commit
e6e82cd9c8
2 changed files with 5 additions and 32 deletions
  1. 3 30
      .config/nixpkgs/neovim/lsp.lua
  2. 2 2
      .config/nixpkgs/neovim/plugins/sources.json

+ 3 - 30
.config/nixpkgs/neovim/lsp.lua

@@ -29,6 +29,8 @@ else
     }
   end
 
+  local base_on_attach = vim.lsp.config["ts_ls"].on_attach
+
   vim.lsp.config("ts_ls", {
     init_options = {
       completionDisableFilterText = true,
@@ -43,21 +45,6 @@ else
       ['$/typescriptVersion'] = function(err, result, ctx, config)
         vim.notify(string.format('Typescript %s', result.version))
       end,
-
-      -- handler used with extract type to interface, etc which asks to rename
-      -- the newly created type
-      ['_typescript.rename'] = function(err, result, ctx)
-        local client = vim.lsp.get_client_by_id(ctx.client_id)
-        vim.lsp.util.show_document({
-          uri = result.textDocument.uri,
-          range = {
-            start = result.position,
-            ['end'] = result.position,
-          }
-        }, client.offset_encoding)
-        vim.lsp.buf.rename()
-        return result
-      end,
     },
     flags = {
       debounce_text_changes = 150,
@@ -75,23 +62,9 @@ else
       })
     end,
     on_attach = function(client)
+      base_on_attach(client)
       -- add custom commands, we follow upstream's Lsp* prefix convention
 
-      -- setup custom source actions, unlike code actions these apply to the
-      -- whole file rather than a particular line.
-      local function source_action(usercmd_name, command_name)
-        vim.api.nvim_buf_create_user_command(0, usercmd_name, function()
-          vim.lsp.buf.code_action({
-            context = { only = { command_name } },
-            apply = true,
-          })
-        end, {})
-      end
-
-      source_action("LspAddMissingImports", "source.addMissingImports.ts")
-      source_action("LspOrganizeImports", "source.organizeImports.ts")
-      source_action("LspRemoveUnusedImports", "source.removeUnusedImports.ts")
-
       -- rename file with import renaming, this does no error checking
       vim.api.nvim_buf_create_user_command(0, "LspRenameFile", function()
         local source = vim.api.nvim_buf_get_name(0)

+ 2 - 2
.config/nixpkgs/neovim/plugins/sources.json

@@ -44,8 +44,8 @@
     "sha256": "01h4lx190vd25vnr1zmmzsi195v45f83dvsisgrqvbqgrbdkhr7d"
   },
   "neovim/nvim-lspconfig": {
-    "rev": "5dae152ee422ed9383217965aff92b331c4c248e",
-    "sha256": "055fc8xpzjvrz9zmzqlnl6wb3cqdqh34ljg6rngxzb3g3fljdpfr"
+    "rev": "c48fac0936f24a5a2dbea9c8379ec9414a45eb8b",
+    "sha256": "1csggqvgn9pr71jmpndfcv3qglgvzwsngs40j1yq4201x38v7z1g"
   },
   "nvim-treesitter/nvim-treesitter-textobjects": {
     "rev": "205e3369bc83d8cb83f7409c36120e24611f8c5c",