Skip to content

v0.18.0

Fix two bugs related to dynamic configuration, that combine to prevent
several clients from correctly configuring gopls, as reported in
golang/go#65519 (Eglot), slack (lsp-mode), and team chat (Helix).

The first bug has existed ~forever: when we make a
workspace/configuration request in response to a didChangeConfiguration
notification, we attempt to fetch the "global" settings by passing
"scopeURI": "". The LSP spec defines "scopeURI" as a nullable URI:

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#configurationItem

Apparently, Javascript-based clients such as VS Code and coc.nvim (the
two clients I regularly test with) will happily accept "" as a falsy
value, and so this global query works. However, this query fails in
Eglot (and likely other clients), causing didChangeConfiguration not to
work.

The second bug is new: When adding a new workspace folder we were
failing to overwrite opts with the correct value (:= vs =, alas). This
initial query had been masking the bug described above in Emacs, whereas
in VS Code the (incorrectly) successful workspace/configuration request
above masked the new bug. Since they both fail in Eglot, they are
revealed.

The fake editor is updated to reject the "" scope, highlighting the
first bug. A new integration test is added to exercise the second bug,
by way of a new integration test option to add per-folder configuration.

Additionally, a marker test is added to exercise static configuration,
which is when the client does not support the configuration capability
at all. This wasn't actually broken, as first suspected, but the test is
useful to include anyway, as we had no tests for this client behavior.

Fixes golang/go#65519

Change-Id: Ie7170e3a26001546d4e334b83e6e73cd4ade10d8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/563475
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Assets 2
Loading