Skip to content

Commit

Permalink
[vim] only use typescript vscode action for js/ts files
Browse files Browse the repository at this point in the history
  • Loading branch information
antonk52 committed Apr 30, 2024
1 parent 3c0ac9a commit 18b2b57
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,12 @@ if vim.g.vscode then
vim.keymap.set('n', 'gd', function()
local filepath = vim.api.nvim_buf_get_name(0)
local is_www_js = string.match(filepath, '/www/') and vim.endswith(filepath, '.js')
local is_ts_or_js = vim.endswith(filepath, '.js')
or vim.endswith(filepath, '.ts')
or vim.endswith(filepath, '.tsx')
require('vscode-neovim').call(
(vim.v.count and not is_www_js) and 'typescript.goToSourceDefinition' or 'editor.action.revealDefinition'
(vim.v.count and not is_www_js and is_ts_or_js) and 'typescript.goToSourceDefinition'
or 'editor.action.revealDefinition'
)
end, {})
vim.keymap.set('n', 'gD', c('editor.action.goToDeclaration'), {})
Expand Down

0 comments on commit 18b2b57

Please sign in to comment.