Gopls: Index of features
This page provides an index of all supported features of gopls that are accessible through the language server protocol (LSP). It is intended for:
- users of gopls learning its capabilities so that they get the most out of their editor;
- editor maintainers adding or improving Go support in an LSP-capable editor; and
- contributors to gopls trying to understand how it works.
In an ideal world, Go users would not need to know that gopls or even LSP exists, as their LSP-enabled editors would implement every facet of the protocol and expose each feature in a natural and discoverable way. In reality, editors vary widely in their support for LSP, so unfortunately these documents necessarily involve many details of the protocol.
We also list settings that affect each feature.
Most features are illustrated with reference to VS Code, but we will briefly mention whether each feature is supported in other popular clients, and if so, how to find it. We welcome contributions, edits, and updates from users of any editor.
Contributors should update this documentation when making significant changes to existing features or when adding new ones.
- Passive: features that are always on and require no special action
- Hover: information about the symbol under the cursor
- Signature Help: type information about the enclosing function call
- Document Highlight: highlight identifiers referring to the same symbol
- Inlay Hint: show implicit names of struct fields and parameter names
- Semantic Tokens: report syntax information used by editors to color the text
- Folding Range: report text regions that can be “folded” (expanded/collapsed) in an editor
- Document Link: extracts URLs from doc comments, strings in current file so client can linkify
- Diagnostics: compile errors and static analysis findings
- Navigation: navigation of cross-references, types, and symbols
- Completion: context-aware completion of identifiers, statements
- Code transformation: fixes and refactorings
- Web-based queries: commands that open a browser page
- Support for non-Go files:
- Command-line interface: CLI for debugging and scripting (unstable)
You can find this page from within your editor by executing the gopls.doc.features
code action, which opens it in a web browser. In VS Code, you can find it on the Quick fix menu.