# How to ask what the code means This guide shows how to follow a name through a Golo file: what it is, where it is declared, and what is wrong with it. It assumes Turbo Golo is installed and the language server is running — the status bar says `LSP: ready` when it is. For moving around a file — searching, jumping to a line, switching windows — see [How to move around a file](navigate-code.md) instead. ## Put the cursor on a name 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. ## Ask | To find | Do | Shortcut | With `golo lsp` | | --- | --- | --- | --- | | What it is | **Code ▸ Describe symbol** | `F1` | answered | | Where it is declared | **Code ▸ Go to definition** | `F12` | answered | | Where its *type* is declared | **Code ▸ Go to type definition** | | nothing found | | What implements it | **Code ▸ Find implementations…** | | answered — its declaration | | Everywhere it is used | **Code ▸ Find references…** | `Shift-F12` | answered, within the file | **One of these five reports nothing with `golo lsp`.** The server is the interpreter itself in language-server mode, and it does not advertise `typeDefinition`, so **Go to type definition** answers nothing found however good the code is. The other four work, within the file: **Find references** lists the declaration and every call, and **Find implementations** answers with the declaration — Golo has no interfaces, so a function is its own implementation. Both symbol searches below work too. See [colouring and completion](../explanation/colouring-and-completion.md) for why the one gap is written down rather than hidden behind a greyed-out menu item. What the two that work know is **the file in front**, at top level: - **Describe symbol** on a function you declared shows its signature and the `#` comments written immediately above it; on a builtin such as `println` or a symbol pulled in by `import` from an embedded module — `gololang.Errors`, `gololang.Types` — it shows the interpreter's own documentation. - **Go to definition** takes you to a top-level function or union declared in the same file. A function imported from a module of your own on disk is not resolved. One answer takes you straight there. Should a question ever come back with several, they open a list showing each file, its line, and the text of that line; move with the arrow keys, `Enter` to go, `Esc` to stay where you are. ## When nothing comes back Three different things look alike, and the status bar tells them apart: | It says | Meaning | | --- | --- | | `No … found`, in the question's own words | The server answered, and there are none — which, for type definitions, is what this server always says | | `LSP: starting…` | The server has not finished starting. Wait a moment and ask again. | | `LSP: off` on the status bar | No server is running. See [How to enable completion](enable-completion.md). | | `LSP: no golo — see https://codeberg.org/TypeUnsafe/golo-script/releases` | There is no `golo` on `PATH` or in `/usr/local/bin`. See [How to install GoloScript](install-goloscript.md). | ## Find something by name instead - **Code ▸ Symbol in file…** lists what the file in front declares, indented, with each symbol's kind — the top-level functions and unions, each union's variants nested under it. An outline you can walk; choosing one goes to it. - **Code ▸ Symbol in project…** (`Ctrl-T`) asks for a name and searches every `.golo` file under the project root, open or not — top-level functions, unions and module names. An empty name lists them all. ## See what is wrong **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. `golo lsp` reports two kinds of problem, on open and again on every edit: syntax errors from its lexer and parser, and lints for the two mistakes it sees most — `:` and `.` confused in a method call, and C-style `//` or `/* */` comments, where Golo uses `#` and `----`. A syntax error is placed on the line the message names, or on line 1 when it names none, and the whole line is marked rather than a column. Lines with a problem carry a mark in the gutter, beside the line number: | Mark | Meaning | | --- | --- | | `×` | An error | | `!` | A warning | | `i` | Information | | `·` | A hint | A line with more than one problem shows the worst of them. **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. ## See also - Every item and its key: [Menus](../reference/menus.md) - Getting a server running: [How to enable completion](enable-completion.md) - What the editor asks, and why: [Colouring and completion](../explanation/colouring-and-completion.md) - What `golo lsp` answers, exactly: [Golo tools](../reference/golo-tools.md)