| 1 |
--- |
| 2 |
title: "Gopls: Index of features" |
| 3 |
--- |
| 4 |
|
| 5 |
This page provides an index of all supported features of gopls that |
| 6 |
are accessible through the [language server protocol](https://microsoft.github.io/language-server-protocol/) (LSP). |
| 7 |
It is intended for: |
| 8 |
- **users of gopls** learning its capabilities so that they get the most out of their editor; |
| 9 |
- **editor maintainers** adding or improving Go support in an LSP-capable editor; and |
| 10 |
- **contributors to gopls** trying to understand how it works. |
| 11 |
|
| 12 |
In an ideal world, Go users would not need to know that gopls or even |
| 13 |
LSP exists, as their LSP-enabled editors would implement every facet |
| 14 |
of the protocol and expose each feature in a natural and discoverable |
| 15 |
way. In reality, editors vary widely in their support for LSP, so |
| 16 |
unfortunately these documents necessarily involve many details of the |
| 17 |
protocol. |
| 18 |
|
| 19 |
We also list [settings](../settings.md) that affect each feature. |
| 20 |
|
| 21 |
Most features are illustrated with reference to VS Code, but we will |
| 22 |
briefly mention whether each feature is supported in other popular |
| 23 |
clients, and if so, how to find it. We welcome contributions, edits, |
| 24 |
and updates from users of any editor. |
| 25 |
|
| 26 |
Contributors should [update this documentation](../contributing.md#documentation) |
| 27 |
when making significant changes to existing features or when adding new ones. |
| 28 |
|
| 29 |
- [Passive](passive.md): features that are always on and require no special action |
| 30 |
- [Hover](passive.md#hover): information about the symbol under the cursor |
| 31 |
- [Signature Help](passive.md#signature-help): type information about the enclosing function call |
| 32 |
- [Document Highlight](passive.md#document-highlight): highlight identifiers referring to the same symbol |
| 33 |
- [Inlay Hint](passive.md#inlay-hint): show implicit names of struct fields and parameter names |
| 34 |
- [Semantic Tokens](passive.md#semantic-tokens): report syntax information used by editors to color the text |
| 35 |
- [Folding Range](passive.md#folding-range): report text regions that can be "folded" (expanded/collapsed) in an editor |
| 36 |
- [Document Link](passive.md#document-link): extracts URLs from doc comments, strings in current file so client can linkify |
| 37 |
- [Diagnostics](diagnostics.md): compile errors and static analysis findings |
| 38 |
- [Navigation](navigation.md): navigation of cross-references, types, and symbols |
| 39 |
- [Definition](navigation.md#definition): go to definition of selected symbol |
| 40 |
- [Type Definition](navigation.md#type-definition): go to definition of type of selected symbol |
| 41 |
- [References](navigation.md#references): list references to selected symbol |
| 42 |
- [Implementation](navigation.md#implementation): show "implements" relationships of selected type |
| 43 |
- [Document Symbol](navigation.md#document-symbol): outline of symbols defined in current file |
| 44 |
- [Symbol](navigation.md#symbol): fuzzy search for symbol by name |
| 45 |
- [Selection Range](navigation.md#selection-range): select enclosing unit of syntax |
| 46 |
- [Call Hierarchy](navigation.md#call-hierarchy): show outgoing/incoming calls to the current function |
| 47 |
- [Type Hierarchy](navigation.md#type-hierarchy): show interfaces/implementations of the current type |
| 48 |
- [Completion](completion.md): context-aware completion of identifiers, statements |
| 49 |
- [Code transformation](transformation.md): fixes and refactorings |
| 50 |
- [Formatting](transformation.md#formatting): format the source code |
| 51 |
- [Rename](transformation.md#rename): rename a symbol or package |
| 52 |
- [Organize imports](transformation.md#source.organizeImports): organize the import declaration |
| 53 |
- [Extract](transformation.md#refactor.extract): extract selection to a new file/function/variable |
| 54 |
- [Inline](transformation.md#refactor.inline.call): inline a call to a function or method |
| 55 |
- [Miscellaneous rewrites](transformation.md#refactor.rewrite): various Go-specific refactorings |
| 56 |
- [Add test for func](transformation.md#source.addTest): create a test for the selected function |
| 57 |
- [Web-based queries](web.md): commands that open a browser page |
| 58 |
- [Package documentation](web.md#doc): browse documentation for current Go package |
| 59 |
- [Free symbols](web.md#freesymbols): show symbols used by a selected block of code |
| 60 |
- [Assembly](web.md#assembly): show listing of assembly code for selected function |
| 61 |
- [Split package](web.md#splitpkg): split a package into two or more components |
| 62 |
- Support for non-Go files: |
| 63 |
- [Template files](templates.md): files parsed by `text/template` and `html/template` |
| 64 |
- [go.mod and go.work files](modfiles.md): Go module and workspace manifests |
| 65 |
- [Go *.s assembly files](assembly.md): Go assembly files |
| 66 |
- [Command-line interface](../command-line.md): CLI for debugging and scripting (unstable) |
| 67 |
- [Model Context Protocol (MCP)](mcp.md): use some features in AI-assisted environments |
| 68 |
|
| 69 |
You can find this page from within your editor by executing the |
| 70 |
`gopls.doc.features` [code action](transformation.md#code-actions), |
| 71 |
which opens it in a web browser. |
| 72 |
In VS Code, you can find it on the "Quick fix" menu. |