go/internal/lsp/testdata
Hana d34cf35d93 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>
2021-03-08 17:39:28 +00:00
..
%percent internal/lsp/testdata: remove diagnostic from percent package 2020-10-01 18:36:08 +00:00
address internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
analyzer internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
anon internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
append internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
arraytype internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
assign internal/lsp/source: omit assign stmt LHS in RHS completion 2020-12-07 20:43:33 +00:00
bad internal/typesinternal: use Go 1.16 metadata for go/types errors 2020-12-07 17:42:14 +00:00
badstmt internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
bar internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
basiclit internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
baz internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
builtins internal/lsp/completion: fix untyped int type inference 2021-02-05 20:20:24 +00:00
callhierarchy internal/lsp/source: return all field funcs from outgoing callhierarchy 2021-01-05 17:25:16 +00:00
casesensitive internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
cast internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
cgo internal/lsp: add ?utm_source=gopls to links to pkg.go.dev 2020-11-16 00:15:58 +00:00
cgoimport internal/lsp: add ?utm_source=gopls to links to pkg.go.dev 2020-11-16 00:15:58 +00:00
channel internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
codelens internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
comment_completion internal/lsp/source: refactor c.item to support deepSearch in all cases 2020-10-01 23:00:09 +00:00
complit internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
constant internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
danglingstmt internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
deep internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
errors internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
extract internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
fieldlist internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
fillstruct gopls, internal/lsp: support fillstruct for partially-filled structs 2020-11-30 20:22:45 +00:00
folding internal/lsp/source: return nil for foldingRange in case of parse error 2021-03-08 17:39:28 +00:00
foo internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
format internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
func_rank internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
funcsig internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
funcvalue internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
fuzzymatch internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
generate internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
generated internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
godef internal/lsp: show human-readable const time.Duration as a comment 2021-03-03 20:04:07 +00:00
good internal/lsp/source: make it an error to rename embedded fields 2021-01-26 13:52:46 +00:00
highlights internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
implementation internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
importedcomplit internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
imports internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
index internal/lsp/completion: fix untyped int type inference 2021-02-05 20:20:24 +00:00
interfacerank internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
keywords internal/lsp: fix some incorrect spelling 2020-11-24 11:59:21 +00:00
labels internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
links internal/lsp: add ?utm_source=gopls to links to pkg.go.dev 2020-11-16 00:15:58 +00:00
maps internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
multireturn internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
nested_complit internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
nodisk internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
noparse internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
noparse_format internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
printf internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
rank internal/lsp/completion: fix untyped ints to match floats 2021-02-05 19:39:34 +00:00
references internal/lsp/source: show references to interface methods 2020-10-06 22:15:05 +00:00
rename internal/lsp/source: make it an error to rename embedded fields 2021-01-26 13:52:46 +00:00
selector internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
semantic internal/lsp: revise some semantic token details 2020-11-24 12:36:21 +00:00
signature internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
snippets internal/lsp/completion: fix invalid struct literal field snippet 2021-02-05 19:39:40 +00:00
statements internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
suggestedfix internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
symbols internal/lsp: don't show blank identifiers in outline 2020-10-09 01:09:51 +00:00
testy internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
typeassert internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
typeerrors internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
types internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
undeclared internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
unimported internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
unresolved internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
unsafe internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
variadic internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
workspacesymbol internal/lsp/source: correct workspace symbol logic for unpacking receivers 2021-03-05 19:21:50 +00:00
summary.txt.golden internal/lsp: show human-readable const time.Duration as a comment 2021-03-03 20:04:07 +00:00