Step 6 of 7

References and the symbol picker

References and the symbol picker

gd answers “where is this defined?”. The opposite question — “where is this used?” — has its own goto command:

  • gr — list every reference to the symbol under the cursor in a picker

A real server knows the difference between the greet in greet(name) and one that happens to sit inside a string, so the list is exact rather than a text search. Picking an entry jumps to it, and that is a jumplist entry like any other.

The last picker lesson 14 had to skip is the symbol picker:

  • Space-s — a picker of the symbols in this buffer
  • Space-S — the same, across the whole workspace

Functions, types, and variables appear with their kind, and picking one jumps to where it is defined. The stand-in lists every fn.

One honest note: Space-r, rename, is the one feature of a language server this embedded editor can’t offer yet — it waits for the server’s answer in a way the browser build can’t deliver.

Below, find the uses of greet, then reach farewell through the symbol picker.

  1. Select the first greet in the file /greet and Enter selects the match on line 1.
  2. List its references with gr and pick the call in main Two entries — the definition and the call on line 8. Take the call.
  3. Open the symbol picker and pick farewell Space-s, filter for it if you like, then Enter.
Select the first greet in the file /greet and Enter selects the match on line 1.

Next: List its references with gr and pick the call in main

Loading editor…