turbo-editors/turbo-pythonpublic Fork 0
v1.0.1
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-python.git
git clone ssh://git@rickub.com/turbo-editors/turbo-python.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

📦 Turbo Python 6fc62ea · on v1.0.1 · k33g · 10h ago
ask-about-code.md · 69 lines · 3.1 KBmarkdown
Blame HistoryOpen raw

How to ask what the code means

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 Python is installed and a 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 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
What it is Code ▸ Describe symbol F1
Where it is declared Code ▸ Go to definition F12
Where its type is declared Code ▸ Go to type definition
What implements it Code ▸ Find implementations…
Everywhere it is used Code ▸ Find references… Shift-F12

One answer takes you straight there. Several open a list showing each file, its line, and the text of that line:

Implementations (2)
  french.py:4   impl Greeter for French {
  english.py:4  impl Greeter for English {

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 references found The server answered, and there are none
Anything else, such as Loading… The server has not finished indexing. Wait a moment and ask again.
LSP: off on the status bar No server is running. See How to enable completion.

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.

Find something by name instead

  • Code ▸ Symbol in file… lists what the file in front declares, indented, with each symbol's kind — an outline you can walk.
  • Code ▸ Symbol in project… (Ctrl-T) asks for a name and searches everywhere. What counts as a match is the server's decision; pylsp matches loosely, so a few letters usually do.

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.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# How to ask what the code means

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 Python is installed and a 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 |
| --- | --- | --- |
| What it is | **Code ▸ Describe symbol** | `F1` |
| Where it is declared | **Code ▸ Go to definition** | `F12` |
| Where its *type* is declared | **Code ▸ Go to type definition** | |
| What implements it | **Code ▸ Find implementations…** | |
| Everywhere it is used | **Code ▸ Find references…** | `Shift-F12` |

One answer takes you straight there. Several open a list showing each file, its line, and the text of that line:

```
Implementations (2)
  french.py:4   impl Greeter for French {
  english.py:4  impl Greeter for English {
```

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 references found` | The server answered, and there are none |
| Anything else, such as `Loading…` | The server has not finished indexing. Wait a moment and ask again. |
| `LSP: off` on the status bar | No server is running. See [How to enable completion](enable-completion.md). |

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.

## Find something by name instead

- **Code ▸ Symbol in file…** lists what the file in front declares, indented, with each symbol's kind — an outline you can walk.
- **Code ▸ Symbol in project…** (`Ctrl-T`) asks for a name and searches everywhere. What counts as a match is the server's decision; pylsp matches loosely, so a few letters usually do.

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

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)