-
Notifications
You must be signed in to change notification settings - Fork 231
Description
Describe the bug
Move keymaps that work in Lua and Python and Typescript do not work when the filetype is typescriptreact
. In the same typescriptreact
file, after running :set filetype=typescript
, the mappings work as expected.
To Reproduce
Using a config like the below:
require "nvim-treesitter.configs".setup({
ensure_installed = { "typescript", "javascript", "python", "lua" },
highlight = { enable = true },
indent = { enable = true },
autopairs = { enable = true },
textobjects = {
select = {
enable = true,
keymaps = {
["if"] = "@function.inner",
["af"] = "@function.outer",
["ic"] = "@class.inner",
["ac"] = "@class.outer",
["ia"] = "@parameter.inner",
["aa"] = "@parameter.outer",
},
},
move = {
enable = true,
goto_next_start = {
["]f"] = "@function.outer",
["]c"] = "@class.outer",
},
goto_previous_start = {
["[f"] = "@function.outer",
["[c"] = "@class.outer",
},
},
},
})
- Open a typescriptreact file
- Observe that
ts_ls
is attached - Press
[f
to jump to a function - Observe that nvim executes the default behavior of
[f
which is synonymous withgf
- Run
:set filetype=typescriptreact
- Press
[f
- Observe that the behavior works as expected
Expected behavior
I expect that [f
should jump to a function when the filetype is typescriptreact
instead of execute gf
Output of :checkhealth nvim-treesitter
==============================================================================
2 nvim-treesitter: 1 ⚠️
3
4 Installation
5 - ⚠️ WARNING tree-sitter executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
6 - ✅ OK node found v22.17.1 (only needed for :TSInstallFromGrammar)
7 - ✅ OK git executable found.
8 - ✅ OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
9 Version: Apple clang version 16.0.0 (clang-1600.0.26.6)
10 - ✅ OK Neovim was compiled with tree-sitter runtime ABI version 15 (required >=13). Parsers must be compatible with runtime ABI.
11
12 OS Info:
13 {
14 machine = "arm64",
15 release = "24.4.0",
16 sysname = "Darwin",
17 version = "Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:50 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6041"
18 }
19
20 Parser/Features H L F I J
21 - c ✓ ✓ ✓ ✓ ✓
22 - javascript ✓ ✓ ✓ ✓ ✓
23 - lua ✓ ✓ ✓ ✓ ✓
24 - markdown ✓ . ✓ ✓ ✓
25 - markdown_inline ✓ . . . ✓
26 - python ✓ ✓ ✓ ✓ ✓
27 - query ✓ ✓ ✓ ✓ ✓
28 - svelte ✓ ✓ ✓ ✓ ✓
29 - typescript ✓ ✓ ✓ ✓ ✓
30 - vim ✓ ✓ ✓ . ✓
31 - vimdoc ✓ . . . ✓
32
33 Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
34 +) multiple parsers found, only one will be used
35 x) errors found in the query, try to run :TSUpdate {lang}
36
Output of nvim --version
NVIM v0.12.0-dev-916+g68eece8b84
Additional context
Add any other context about the problem here.