go/internal/lsp/source
Robert Findley f1bb5ca08f internal/lsp/cache: report a critical error when go.work is invalid
When a go.work file fails to validate, the workspace is left in an
invalid state: we will detect that the workspace is defined by the
go.work, but will not actually parse any active modules. This should be
a critical error.

Fix this by adding allowing the workspace to surface critical errors via
a new cache.workspace.criticalError method.

Additionally:
 - only build the workspace mod file in workspace.build if the mode is
   fileSystemWorkspace (in all other modes the modfile is already
   determined)
 - rename workspace.invalidate to workspace.Clone, to be consistent with
   other data structures
 - rename CriticalError.DiagList to CriticalError.Diagnostics
 - add several TODOs for observations while reading the code
 - create a new file for regtests related to broken workspaces
 - make the regtest sandbox panic when duplicate paths are present in
   the sandbox file set (an error I made while writing the test)

Updates golang/go#53933

Change-Id: If8625ab190129bc9c57e784314bc9cc92644c955
Reviewed-on: https://go-review.googlesource.com/c/tools/+/417593
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
2022-07-27 18:59:40 +00:00
..
completion internal/lsp/cache: move PosTo{Decl,Field} out of cache 2022-07-13 14:49:57 +00:00
add_import.go
api_json.go internal/lsp: update inlay hints documentation to include go snippets 2022-07-26 18:27:49 +00:00
call_hierarchy.go internal/span: make NewRange accept File, not FileSet 2022-07-06 19:40:50 +00:00
code_lens.go internal/span: make NewRange accept File, not FileSet 2022-07-06 19:40:50 +00:00
comment.go gopls, internal/lsp: gofmt 2022-04-12 17:41:31 +00:00
comment_test.go
diagnostics.go internal/lsp: remove unused code 2022-03-17 13:53:41 +00:00
extract.go internal/span: make NewRange accept File, not FileSet 2022-07-06 19:40:50 +00:00
fix.go internal/span: make NewRange accept File, not FileSet 2022-07-06 19:40:50 +00:00
folding_range.go internal/span: make NewRange accept File, not FileSet 2022-07-06 19:40:50 +00:00
format.go internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
format_test.go
gc_annotations.go
highlight.go internal/lsp/source: eliminate ColumnMapper.PointSpan in favor of Pos 2022-06-01 19:19:59 +00:00
hover.go internal/lsp/cache: move PosTo{Decl,Field} out of cache 2022-07-13 14:49:57 +00:00
identifier.go internal/lsp/cache: move PosTo{Decl,Field} out of cache 2022-07-13 14:49:57 +00:00
identifier_test.go internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
implementation.go internal/lsp/source: use token.File-agnostic positions to dedupe refs 2022-07-12 14:39:04 +00:00
inlay_hint.go internal/lsp: suppress parameter hint when argument matches parameter 2022-07-26 18:43:08 +00:00
known_packages.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
options.go internal/lsp/diff: new diff implementation to replace go-diff 2022-07-24 16:55:18 +00:00
options_test.go gopls: upgrade staticcheck to v0.3.0 2022-04-07 14:59:24 +00:00
references.go internal/lsp: Refactor to share logic with rename 2022-07-25 19:36:27 +00:00
rename.go internal/span: make NewRange accept File, not FileSet 2022-07-06 19:40:50 +00:00
rename_check.go internal/span: make NewRange accept File, not FileSet 2022-07-06 19:40:50 +00:00
signature_help.go internal/lsp/cache: move PosTo{Decl,Field} out of cache 2022-07-13 14:49:57 +00:00
source_test.go internal/lsp/regtest: allow sharing memoized results across regtests 2022-07-26 21:20:42 +00:00
stub.go internal: remove unneeded FileSets 2022-06-06 20:47:10 +00:00
symbols.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
types_format.go internal/lsp/cache: move PosTo{Decl,Field} out of cache 2022-07-13 14:49:57 +00:00
util.go gopls/internal/regtest: externalize shouldLoad tracking 2022-07-22 21:31:20 +00:00
util_test.go internal/span: make NewRange accept File, not FileSet 2022-07-06 19:40:50 +00:00
view.go internal/lsp/cache: report a critical error when go.work is invalid 2022-07-27 18:59:40 +00:00
workspace_symbol.go internal/lsp: Update FilterDisallow to support matching directories at arbitrary depth. 2022-07-18 17:53:36 +00:00
workspace_symbol_test.go internal/lsp: Update FilterDisallow to support matching directories at arbitrary depth. 2022-07-18 17:53:36 +00:00