|
1 | 1 | # [`gopls`], the Go language server
|
2 | 2 |
|
3 |
| -[`gopls`] is the official Go [language server](https://langserver.org/) developed by the Go team. It was developed in response to the release of [Go modules], and it is the recommended approach when working with [Go modules] in VS Code. |
4 |
| - |
5 |
| -[`gopls`] is currently in an alpha state, so it is not enabled by default. Please note that [`gopls`] only supports Go versions above 1.12. |
| 3 | +[`gopls`] is the official Go [language server](https://langserver.org/) developed by the Go team. It was developed in response to the release of [Go modules], and it is the recommended approach when working with [Go modules] in VS Code. [`gopls`] is not enabled by default yet and users have to opt in by changing from [their settings](#enable-the-language-server). We plan to switch the default and enable it by default early 2021. |
6 | 4 |
|
7 | 5 | [`gopls`] has its own [documentation pages](https://github.com/golang/tools/tree/master/gopls/doc), and they should be treated as the source of truth for how to use [`gopls` in VS Code](https://github.com/golang/tools/blob/master/gopls/doc/vscode.md).
|
8 | 6 |
|
|
13 | 11 | * [Automatic updates](#automatic-updates)
|
14 | 12 | * [Configuration](#configuration)
|
15 | 13 | * [Ignored settings](#ignored-settings)
|
16 |
| - * [`gopls` settings block](#gopls-settings-block) |
17 | 14 | * [Troubleshooting](https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md)
|
18 | 15 | * [Additional resources](#additional-resources)
|
19 | 16 |
|
@@ -41,27 +38,18 @@ If you would like to opt-out of these updates, set [`"go.useGoProxyToCheckForToo
|
41 | 38 |
|
42 | 39 | There are a number of VS Code Go settings for controlling the language server.
|
43 | 40 |
|
| 41 | +* [`"go.toolsEnvVars"`](settings.md#go.toolsEnvVars) is used when launching `gopls` for the workspace. |
| 42 | +* [`"go.buildFlags"`](settings.md#go.buildFlags) and [`"go.buildTags"`](settings.md#go.buildTags) are propagated to `gopls`. |
44 | 43 | * [`"go.languageServerExperimentalFeatures"`](settings.md#go.languageServerExperimentalFeatures) allows you to disable certain features.
|
45 | 44 | * `"diagnostics": false` disables diagnostic warnings from `gopls`. You might want to disable these if you don't like the diagnostics changing as you type.
|
46 |
| - * `"documentLink": false` disables document links. The reason to disable these is explained in [golang/go#39065](https://github.com/golang/go/issues/39065): the Ctrl+Click shortcut for clicking on a link collides with the Ctrl+Click shortcut for go-to-definition. |
| 45 | + * `"documentLink": false` is deprecated by `"gopls": { "importShortcut": false }` setting. It was originally meant to disable document links. The reason to disable these is explained in [golang/go#39065](https://github.com/golang/go/issues/39065): the Ctrl+Click shortcut for clicking on a link collides with the Ctrl+Click shortcut for go-to-definition. |
47 | 46 | * [`"go.languageServerFlags"`](settings.md#go.languageServerFlags) allows you to pass flags to the `gopls` process.
|
48 | 47 | * The `-rpc.trace` flag enables verbose debug logging.
|
| 48 | +* [`"gopls"`](settings.md#gopls) allows to fine-tune gopls behavior or override the settings propagated from the extension settings (e.g. `"go.buildFlags"`, `"go.toolsEnvVars"`) as shown in the [`gopls` VS Code user guide](https://github.com/golang/tools/blob/master/gopls/doc/vscode.md). The sets of settings recognized by the extension and the gopls may differ if you use an old version or a pre-release version of `gopls`. In that case, the source of truth is in [the documentation](https://github.com/golang/tools/tree/master/gopls/doc/settings.md) in the `gopls` project. |
49 | 49 |
|
50 | 50 | ### Ignored settings
|
51 | 51 |
|
52 |
| -A number of the extension's settings are not passed in to `gopls`. We are working on unifying all of the settings, but some may still be ignored. These include: |
53 |
| - |
54 |
| -* [`"go.buildFlags"`](settings.md#go.buildFlags) |
55 |
| - |
56 |
| -These configurations can be passed to `gopls` via your environment or the `gopls.env` setting. Learn more in the [`gopls` VS Code documentation](https://github.com/golang/tools/blob/master/gopls/doc/vscode.md#build-tags). |
57 |
| - |
58 |
| -### `gopls` settings block |
59 |
| - |
60 |
| -`gopls` exposes much more [configuration](https://github.com/golang/tools/blob/master/gopls/doc/settings.md). However, because [`gopls`] is in a state of rapid development and change, these settings change frequently. Therefore, we have not yet built these settings into the Go extension. |
61 |
| - |
62 |
| -As shown in the [`gopls` VS Code user guide](https://github.com/golang/tools/blob/master/gopls/doc/vscode.md), you can still configure these settings through VS Code by adding a `"gopls"` block to your `settings.json` file (Command Palette -> Preferences: Open Settings (JSON)). **You will see an `Unknown Configuration Setting` warning, but the settings will still work.** Add any settings there, and `gopls` will warn you if they are incorrect, unknown, or deprecated. |
63 |
| - |
64 |
| -A full list of `gopls` settings is available in the [`gopls` settings documentation](https://github.com/golang/tools/blob/master/gopls/doc/settings.md). |
| 52 | +Some of the extension's settings are irrelevant when `gopls` is enabled. For example, the extension no longer uses `gocode` or `guru`, so the corresponding settings are no longer applicable. We are trying to document that in the settings' description and the [settings documentation](settings.md). When you find incompelete documentation, please file an issue or send a PR! |
65 | 53 |
|
66 | 54 | ## Additional resources
|
67 | 55 |
|
|
0 commit comments