Using LSP-Based Completion
LSP will serve completion if you enter trigger characters in the editor. Currently, the trigger characters are:
- any valid identifier character, like
'a'
or'Z'
. '#'
,'('
,'<'
,'.'
,':'
,'/'
,'"'
,'@'
, which is configured by LSP server.
VSCode:
Besides, you can trigger the completion manually by pressing Ctrl+Space
in the editor.
If Ctrl+Space
doesn't work, please check your IME settings or keybindings.
When an item is selected, it will be committed if some character is typed.
- press
Esc
to avoid commit. - press
Enter
to commit one. - press
'.'
to commit one for those that can interact with the dot operator. - press
';'
to commit one in code mode. - press
','
to commit one in list.
Label Completion
The LSP will keep watching and compiling your documents to get available labels for completion. Thus, if it takes a long time to compile your document, there will be an expected delay after each editing labels in document.
A frequently asked question is how to completing labels in sub files when writing in a multiple-file project. By default, you will not get labels from other files, e.g. bibiliography configured in other files. This is because the "main file" will be tracked when your are switching the focused files. Hence, the solution is to set up the main file correctly for the multi-file project.
VSCode:
Neovim:
Helix:
Using Snippet-Based Completion
VSCode:
We suggest to use snippet extensions powered by TextMate Scopes. For example, HyperSnips provides context-sensitive snippet completion.