# Opportunities for indexing?

**URL:** <https://racket.discourse.group/t/opportunities-for-indexing/1321>\
**Category:** Questions & Answers\
**Tags:** drracket\
**Created:** [September 22, 2022, 6:42pm UTC](https://racket.discourse.group/t/opportunities-for-indexing/1321 "2022-09-22T18:42:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [September 22, 2022, 6:42pm UTC](https://racket.discourse.group/t/opportunities-for-indexing/1321/1 "2022-09-22T18:42:04Z")

</div>

Background: I was looking at the comments on [Open defining file should jump to definition · Issue #273 · racket/drracket · GitHub](https://github.com/racket/drracket/issues/273)

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.

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/315c8f2417a73ea1b6609487591acc858085ae73.png)

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](https://github.com/racket/drracket/issues/273) is an issue for Vim/Racket-Mode/racket-langserver

Best regards

Stephen

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [September 22, 2022, 7:39pm UTC](https://racket.discourse.group/t/opportunities-for-indexing/1321/2 "2022-09-22T19:39:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Post date:** [September 23, 2022, 3:26am UTC](https://racket.discourse.group/t/opportunities-for-indexing/1321/3 "2022-09-23T03:26:44Z")

</div>

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`](https://docs.racket-lang.org/reference/Module_Names_and_Loading.html#%28def._%28%28quote._~23~25kernel%29._module-compiled-exports%29%29).

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.)
