跳转到内容

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.

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.

  1. Type a name, or a . after an expression. The list opens by itself after a moment; it does not open inside comments and strings.
  2. 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.
  3. ↩ 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.

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

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.

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

Keyboard of
ActionShortcut
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 DocumentationF1 or ⌃JCtrlQ
View › Type Info⌃⇧PCtrlShiftP
  • 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.

The same suggestions, signatures and documentation as tools; none of them needs a right.

  • complete_codereadsCompletion proposals at a position of a workspace file from its language server: label, kind, detail and insert text.
  • hover_symbolreadsHover information (type, signature, documentation) for the symbol at a position of a workspace file, from its language server.
  • signature_helpreadsSignatures 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_codereadsSmart 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.