Complete code and read documentation
此内容尚不支持你的语言。
Completion suggests names as you type, with their signature and documentation, and adds the import a suggestion needs. Parameter info and quick documentation show what a function expects without leaving the line. All of it: Works.
Before you start
Section titled “Before you start”Suggestions, signatures and documentation come from the language server of the file’s language,
working on the text as it is in the editor, saved or not. Install it as the page of
your language says. Without a server the status bar says
No suggestions; Cyclic Expand Word (⌥/) still completes from the words
of the open file.
Complete as you type
Section titled “Complete as you type”- Type a name, or a
.after an expression. The list opens by itself after a moment; it does not open inside comments and strings. - Each row shows the kind, the name with the typed part highlighted, the signature and the type. The documentation of the selected row is shown next to the list.
- ↩ inserts the suggestion. Tab replaces the rest of the name after the caret instead. ⌃. inserts it followed by a dot.
To open the list by hand, choose Code › Code Completion (⌃Space). macOS may take ⌃Space for switching input sources; ⌥Esc works too.
Auto-import. When a suggestion comes from a module that is not imported yet, accepting it adds the import as well, in the same undo step. In Python, names of the standard library are offered with their import.
Narrow the list
Section titled “Narrow the list”- Smart type completion (⌃⇧Space) keeps only suggestions of the
type expected at the caret: from a declaration, an assignment, an argument or a
return. The hint line under the list names that type. It compares type names; it is not a compiler. Not in Python. - Code › Class Name Completion (⌃⌥Space) keeps classes, interfaces, enums and structs.
Postfix and live templates
Section titled “Postfix and live templates”A postfix template turns the expression before it into something else. Type the expression, a dot and the template’s name, and accept it from the list:
| Language | Postfix templates | Examples |
|---|---|---|
| Python | if, ifn, ifnn, not, var, for, fori, while, with, print, return, yield, raise, par, len, str, list, set, tuple, dict, isinstance, main |
item.name.print → print(item.name) |
| JavaScript, TypeScript | const, let, var, if, else, not, null, notnull, return, for, forin, fori, log, par, await, typeof |
total.log → console.log(total); |
| Java | the templates of the Java language server | sout → System.out.println() |
Code › Insert Live Template… (⌘J, CtrlJ) lists the
snippets the language server offers at the caret, such as tfn from rust-analyzer or main from
the Java server. Python has templates of its own: main, iter, itere, prop, super; type the
abbreviation and press Tab. In a template, Tab and ⇧Tab move
between its places. There is no editor for templates of your own yet.
Parameter info
Section titled “Parameter info”Typing ( after a function name shows its parameters above the line after a second, the current
one in bold. View › Parameter Info (⌘P, CtrlP) shows it
for the call at the caret.
- Tab and ⇧Tab move between the arguments.
- With several overloads, one row each: ⌥↑ and ⌥↓ (Ctrl↑ and Ctrl↓) choose which one to highlight.
- Esc closes it. Outside a call it says
No parameters to show here.
Quick documentation
Section titled “Quick documentation”- View › Quick Documentation (F1 on macOS, CtrlQ on Linux) shows the documentation of the name at the caret in a popup. Resting the mouse on a name shows it too.
- External Documentation (⇧F1) opens the first web link of that documentation in your browser.
- View › Type Info shows the type of the expression at the caret.
- View › Quick Definition shows the source of the declaration.
The text is what the language server sends, rendered from Markdown. With nothing to show:
No documentation found.
Shortcuts
Section titled “Shortcuts”| Action | Shortcut |
|---|---|
| Code › Class Name Completion | ⌃⌥SpaceCtrlAltSpace |
| Code › Code Completion | ⌃Space or ⌥⎋CtrlSpace |
| Code › Insert Live Template | ⌘JCtrlJ |
| Editor choose lookup item dotEditorChooseLookupItemDot | ⌃.Ctrl. |
| External java docExternalJavaDoc | ⇧F1ShiftF1 |
| Hippie completionHippieCompletion | ⌥/Alt/ |
| Smart type completionSmartTypeCompletion | ⌃⇧SpaceCtrlShiftSpace |
| View › Parameter Info | ⌘PCtrlP |
| View › Quick Definition | ⌥Space or ⌘YCtrlShiftI |
| View › Quick Documentation | F1 or ⌃JCtrlQ |
| View › Type Info | ⌃⇧PCtrlShiftP |
When it does not work
Section titled “When it does not work”No suggestions. The language server has none here, or is not running. The status bar and the server list of your language show its state.- Completion never opens by itself. The caret is in a comment or a string, where it stays closed; ⌃Space opens it anyway.
- ⌃Space switches the keyboard language on macOS. Use ⌥Esc, or turn off the input-source shortcut in the macOS keyboard settings.
For agents
Section titled “For agents”The same suggestions, signatures and documentation as tools; none of them needs a right.
complete_codeCompletion proposals at a position of a workspace file from its language server: label, kind, detail and insert text.hover_symbolHover information (type, signature, documentation) for the symbol at a position of a workspace file, from its language server.signature_helpSignatures of the call around a position of a workspace file (parameter info), from its language server: each overload's label, documentation and parameter ranges (chars of the label), the active overload and the parameter the position is in.smart_complete_codeSmart type completion at a position of a workspace file: the type expected there (from a declaration, assignment, argument or return) and the completion items of a fitting type, best first.
No tool matches. Try fewer words, or .