Background: I was looking at the comments on Open defining file should jump to definition · Issue #273 · racket/drracket · GitHub
I'm wondering at what points identifiers are gathered, and if they would be opportunities for building an index of the file so 'Open Defining File?' can jump to the definition even in large files.
Three the things immediately jump out at me as options, but I don't know if they inspect the file separately, or are all front ends on the one thing.
- (define ...) button - this pops up a list of defines
- check-syntax - arrows, highlighting etc.
- compilation - does this create a 'symbol table'? (or does it only create one when it can successfully compile?)
The goal here is to build an index that can support a fast jump to a definition, rather than just jumping to the file.
While this is specifically about DrRacket I'm interested if this Open defining file should jump to definition · Issue #273 · racket/drracket · GitHub is an issue for Vim/Racket-Mode/racket-langserver
Best regards
Stephen
1 Like
AFAICT, the langserver supports "Go to Definition" and "Find References" but not "Open defining file." The first goes directly to the definition. The second (attempts) to find all binding occurrences.
Since my encouraged use of Vim + Racket is to use the langserver for these features, Vim functions identically.
2 Likes
I think the story here is that identifier-binding
is an existing and efficient index getting you directly to the defining file. This elides any chain of re-provides and renames; you can jump directly to that file.
Finding the definition within the file, is the additional, "missing" step.
Hand-wavy vague idea: Maybe compilation of primitive forms like define-values
could tuck the srcloc vector of identifiers into some side table so that it could be returned by module-compiled-exports
.
In other words maybe this could be added as optional extra information to return, similar to how it was extended with the verbosity
argument? (I suppose a riff on this would be a new verbosity where the defined name isn't a symbol, it's syntax, and the syntax srcloc functions can be used.)
3 Likes