nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
How to press once shortcut key to automatically jump class or function?
Nobody has claimed this yet.
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
Is there a way to automatically determine whether the current context is a function or a class, and then set the same shortcut key to jump?
There will be problems if set the same settings directly
goto_previous_start = {
["[m"] = "@function.outer",
["[m"] = "@class.outer",
},
When using the treesitter-context plugin, it can get the corresponding line number like this. I want to automatically jump to the corresponding place.
For example, in go, when I am in a function or structure, I can jump to the definition by pressing [m
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Go example with the shown goto_previous_start mappings and inspect how the treesitter-context plugin identifies the current context and line. The feature is done when one shortcut can determine whether the current location is in a function or class/structure and jump to the corresponding definition without duplicate mappings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, neovim
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100