Protocols
Saved & recent

LSP completion

Also called: textDocument/completion, completionItem/resolve

Completion asks a language server for useful suggestions at a document position. The server can return items with labels, insertion text or edits, and hints for sorting or filtering. The editor presents those options; a suggestion does not change the document merely because the server returned it.

For example, typing pri can produce a print suggestion. If supported, selecting that item can trigger completionItem/resolve to fetch documentation. By default, only detail and documentation can be filled in later; clients can explicitly permit other properties. Any property outside that declared set must already be supplied and remain unchanged. The editor applies the suggestion when the user accepts it.

Read first
LSP document synchronization
Related
LSP document synchronization, LSP initialization, JSON-RPC
Further reading
Microsoft — LSP 3.18 completion
pri│ textDocument/completion suggestions · print selected: print completionItem/resolve documentation panel Print a value text stays pri pri│ accept original edit print│
Completion supplies insertion instructions; an optional resolve request can fetch documentation for the selected suggestion.

View in the full Protocols collection