Link to definition #6137
Unanswered
mrienstra
asked this question in
Code Search and Navigation
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The "jump to definition" feature was first introduced June 11, 2019.
Sometimes it would be helpful to permalink to a definition: within a static file, with a static name, but a dynamic line number.
Random example: If I wanted to link to the
SyntaxNode
Interface
in thelib/binding_web/tree-sitter-web.d.ts
file in thetree-sitter
repo:Currently the only "direct" way to do so is via line number:
https://github.com/tree-sitter/tree-sitter/blob/master/lib/binding_web/tree-sitter-web.d.ts#L57
I could instead use a search link, which works reasonably well in this particular instance, but wouldn't in many repos, which would have lots of results includes docs & tests (granted, some of those could be filtered out using the language filter):
https://github.com/tree-sitter/tree-sitter/search?q=SyntaxNode
I'm proposing something like the following (exact syntax TBD), where
D
stands for "definition":https://github.com/tree-sitter/tree-sitter/blob/master/lib/binding_web/tree-sitter-web.d.ts#D:SyntaxNode:Interface
Related: Creating a permanent link to a code snippet
Beta Was this translation helpful? Give feedback.
All reactions