Browse Source

nixpkgs/neovim: use better go to definition for typescript

Thomas Dy 3 months ago
parent
commit
1295de2f1a
1 changed files with 4 additions and 1 deletions
  1. 4 1
      .config/nixpkgs/neovim/lsp.lua

+ 4 - 1
.config/nixpkgs/neovim/lsp.lua

@@ -31,7 +31,8 @@ if vim.fn.executable("node_modules/.bin/eslint") == 1 then
       client.server_capabilities.documentFormattingProvider = true
       client.server_capabilities.documentRangeFormattingProvider = true
 
-      on_attach(client, bufnr)
+      -- mappings should have been attached by typescript and re-attaching can
+      -- overwrite the typescript specific overrides
     end,
   })
 end
@@ -72,6 +73,8 @@ else
         local opts = { silent = true, buffer = bufnr }
         -- exclude import statements from reference search (may have false positives)
         vim.keymap.set('n', 'gr', '<cmd>Telescope lsp_references default_text=!import\\ <CR>', opts)
+        vim.keymap.set('n', 'gd', '<cmd>TypescriptGoToSourceDefinition<CR>', opts)
+        vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
       end
     }
   })