| commit | d34cf35d935e267701892463a85376dcf5bac263 | [log] [tgz] |
|---|---|---|
| author | Hana <hyangah@gmail.com> | Fri Feb 12 13:26:25 2021 -0500 |
| committer | Hyang-Ah Hana Kim <hyangah@gmail.com> | Mon Mar 08 17:39:28 2021 +0000 |
| tree | cad3a6ec8a52dc9d0e86f4712181b22cc8fdd93c | |
| parent | c5f5f4bed3087b1a3851f3d3dbca15bb3883b5d7 [diff] |
internal/lsp/source: return nil for foldingRange in case of parse error When parse errors occur, go's parse package cannot recover nicely. gopls tried to compute folding ranges based on the partial info in this case, but returning partial folding range info confuses editors (vscode) and results in dropping previous folding range info from the region after the parse error location. This CL makes gopls not to return anything - so the editor can tell the result is not believable and ignore it. The ideal solution is to return a response explicitly surfacing this case, but currently LSP (3.16, as of today) does not have a way to describe this condition. See the discussion in https://github.com/microsoft/language-server-protocol/issues/1200. We also tried to make gopls return an error. While it worked nicely in VSCode, we are not sure about how other editors handle errors from foldingRange. So, instead, we just let gopls return an empty result - since foldingRange is already broken in this case, we hope it doesn't add a lot of noise to existing users. VSCode Go will check the response from the middleware. If the response is empty but the file is not empty, VSCode Go will ignore the response. (https://go-review.googlesource.com/c/vscode-go/+/299569) Updates golang/vscode-go#1224 Updates golang/go#41281 Change-Id: I917d6667508aabbca1906137eb5e21a97a6cfdaf Reviewed-on: https://go-review.googlesource.com/c/tools/+/291569 Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This subrepository holds the source for various packages and tools that support the Go programming language.
Some of the tools, godoc and vet for example, are included in binary Go distributions.
Others, including the Go guru and the test coverage tool, can be fetched with go get.
Packages include a type-checker for Go and an implementation of the Static Single Assignment form (SSA) representation for Go programs.
The easiest way to install is to run go get -u golang.org/x/tools/.... You can also manually git clone the repository to $GOPATH/src/golang.org/x/tools.
This repository uses prettier to format JS and CSS files.
The version of prettier used is 1.18.2.
It is encouraged that all JS and CSS code be run through this before submitting a change. However, it is not a strict requirement enforced by CI.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the tools repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/tools/(your subdir):” in the subject line, so it is easy to find.