| 📦 Turbo Rust 713ea5c k33g 12h ago | 1 | # How to ask what the code means |
| 2 | |
| 3 | This guide shows how to follow a name through a project: where it is declared, what implements it, everywhere it is used, and what is wrong with it. It assumes Turbo Rust is installed and a language server is running — the status bar says `LSP: ready` when it is. |
| 4 | |
| 5 | For moving around a file — searching, jumping to a line, switching windows — see [How to move around a file](navigate-code.md) instead. |
| 6 | |
| 7 | ## Put the cursor on a name |
| 8 | |
| 9 | Any character of it will do. Every question below asks about the **position of the cursor**, not about a selection, so there is nothing to highlight first. |
| 10 | |
| 11 | ## Ask |
| 12 | |
| 13 | | To find | Do | Shortcut | |
| 14 | | --- | --- | --- | |
| 15 | | What it is | **Code ▸ Describe symbol** | `F1` | |
| 16 | | Where it is declared | **Code ▸ Go to definition** | `F12` | |
| 17 | | Where its *type* is declared | **Code ▸ Go to type definition** | | |
| 18 | | What implements it | **Code ▸ Find implementations…** | | |
| 19 | | Everywhere it is used | **Code ▸ Find references…** | `Shift-F12` | |
| 20 | |
| 21 | One answer takes you straight there. Several open a list showing each file, its line, and the text of that line: |
| 22 | |
| 23 | ``` |
| 24 | Implementations (2) |
| 25 | french.rs:4 impl Greeter for French { |
| 26 | english.rs:4 impl Greeter for English { |
| 27 | ``` |
| 28 | |
| 29 | Move with the arrow keys, `Enter` to go, `Esc` to stay where you are. |
| 30 | |
| 31 | ## When nothing comes back |
| 32 | |
| 33 | Three different things look alike, and the status bar tells them apart: |
| 34 | |
| 35 | | It says | Meaning | |
| 36 | | --- | --- | |
| 37 | | `No references found` | The server answered, and there are none | |
| 38 | | Anything else, such as `Loading…` | The server has not finished indexing. Wait a moment and ask again. | |
| 39 | | `LSP: off` on the status bar | No server is running. See [How to enable completion](enable-completion.md). | |
| 40 | |
| 41 | The middle one is worth knowing: a server still indexing answers every question with nothing, and that is indistinguishable from a real answer unless the editor says so. |
| 42 | |
| 43 | ## Find something by name instead |
| 44 | |
| 45 | - **Code ▸ Symbol in file…** lists what the file in front declares, indented, with each symbol's kind — an outline you can walk. |
| 46 | - **Code ▸ Symbol in project…** (`Ctrl-T`) asks for a name and searches everywhere. What counts as a match is the server's decision; rust-analyzer matches loosely, so a few letters usually do. |
| 47 | |
| 48 | ## See what is wrong |
| 49 | |
| 50 | **Code ▸ Problems…** lists every problem the server has reported, for **every file it has loaded** — usually more than the one you are editing. Choosing one goes to the line. |
| 51 | |
| 52 | Lines with a problem carry a mark in the gutter, beside the line number: |
| 53 | |
| 54 | | Mark | Meaning | |
| 55 | | --- | --- | |
| 56 | | `×` | An error | |
| 57 | | `!` | A warning | |
| 58 | | `i` | Information | |
| 59 | | `·` | A hint | |
| 60 | |
| 61 | A line with more than one problem shows the worst of them. |
| 62 | |
| 63 | **The marks need the line numbers.** They sit in the column that separates the numbers from the text, so hiding the gutter with **Options ▸ Line numbers** hides them too. |
| 64 | |
| 65 | ## See also |
| 66 | |
| 67 | - Every item and its key: [Menus](../reference/menus.md) |
| 68 | - Getting a server running: [How to enable completion](enable-completion.md) |
| 69 | - What the editor asks, and why: [Colouring and completion](../explanation/colouring-and-completion.md) |