go/internal/lsp
Robert Findley 76325da620 internal/lsp/progress: detach context for all progress notifications
Use a detached Context for all progress notifications. In particular,
using a detached Context for the window/workDoneProgress/create
notification avoids races where the $/cancelRequest notification and
create response cross paths, such that the client has created a progress
dialog but the server thinks that starting progress failed.

Also, as a matter of best practice don't store a context on the WorkDone
type, despite the fact that this Context is detached. Instead, only
close over a Context in the WorkDoneWriter, which requires a Context in
order to function but which implements the io.Writer interface.

The TestProgressBarErrors test should now pass reliably.

Fixes golang/go#46930

Change-Id: I0d115ed3a62de97fe545c8dc0403e7bb55f6e481
Reviewed-on: https://go-review.googlesource.com/c/tools/+/409936
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-06-02 20:26:04 +00:00
..
analysis internal/lsp/analysis/stubmethods: recognize *ast.CallExpr 2022-05-17 17:04:34 +00:00
browser
bug internal/lsp: add missing bug reporting, and panic during marker tests 2022-05-31 14:14:38 +00:00
cache internal/lsp/progress: detach context for all progress notifications 2022-06-02 20:26:04 +00:00
cmd internal/lsp: factor out column mapper construction from content 2022-06-01 19:19:49 +00:00
command gopls/internal/vulncheck: copy logic of govulncheck -html 2022-05-12 21:17:31 +00:00
debug internal/lsp/bug: add a package for bug reporting 2022-05-16 14:45:30 +00:00
diff internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
fake gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
fuzzy gopls, internal/lsp: gofmt 2022-04-12 17:41:31 +00:00
helper internal/lsp/protocol: update LSP definitions and stubs 2021-10-05 16:44:45 +00:00
lsppos internal/lsp: factor out go/token wrapper into a safetoken package 2022-05-09 17:03:37 +00:00
lsprpc gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
mod internal/lsp/mod: fix broken assumptions about file base 2022-06-01 22:04:06 +00:00
progress internal/lsp/progress: detach context for all progress notifications 2022-06-02 20:26:04 +00:00
protocol internal/lsp/mod: fix broken assumptions about file base 2022-06-01 22:04:06 +00:00
regtest internal/lsp/regtest: only print RPC logs if asked 2022-05-17 21:46:20 +00:00
safetoken internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
snippet lsp/completion: fix literal completions with type params 2022-04-26 02:30:39 +00:00
source internal/lsp/source: eliminate ColumnMapper.PointSpan in favor of Pos 2022-06-01 19:19:59 +00:00
template internal/lsp: fix source.CompareDiagnostic asymmetry 2022-05-11 17:43:03 +00:00
testdata internal/lsp/analysis/stubmethods: recognize *ast.CallExpr 2022-05-17 17:04:34 +00:00
tests internal/lsp: factor out column mapper construction from content 2022-06-01 19:19:49 +00:00
work internal/lsp/source: eliminate ColumnMapper.PointSpan in favor of Pos 2022-06-01 19:19:59 +00:00
README.md
call_hierarchy.go
code_action.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
code_lens.go internal/lsp: honor the file kind provided by clients for overlays 2022-01-13 20:54:45 +00:00
command.go internal/lsp/progress: detach context for all progress notifications 2022-06-02 20:26:04 +00:00
completion.go internal/lsp/source: remove workaround for newline terminated files 2022-06-01 15:40:59 +00:00
completion_test.go internal/lsp/completion: move postfix completions behind option 2021-03-29 18:55:49 +00:00
debounce.go internal/lsp: adopt bcmills' suggestion for an improved debouncer API 2021-07-13 16:40:23 +00:00
debounce_test.go internal/lsp: adopt bcmills' suggestion for an improved debouncer API 2021-07-13 16:40:23 +00:00
definition.go internal/lsp: use the correct converter for mapped range offsets 2022-06-01 15:32:54 +00:00
diagnostics.go internal/lsp/progress: detach context for all progress notifications 2022-06-02 20:26:04 +00:00
folding_range.go
format.go internal/lsp: add support for formatting go.work files 2022-02-15 17:15:32 +00:00
general.go internal/lsp/progress: detach context for all progress notifications 2022-06-02 20:26:04 +00:00
highlight.go internal/lsp: honor the file kind provided by clients for overlays 2022-01-13 20:54:45 +00:00
hover.go internal/lsp: add hover for go.work use statements 2022-03-04 19:55:36 +00:00
implementation.go
link.go internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
lsp_test.go internal/lsp: factor out column mapper construction from content 2022-06-01 19:19:49 +00:00
references.go internal/lsp: honor the file kind provided by clients for overlays 2022-01-13 20:54:45 +00:00
rename.go internal/lsp: use placeholders with prepare rename 2022-02-15 00:29:01 +00:00
reset_golden.sh
semantic.go internal/lsp/mod: fix broken assumptions about file base 2022-06-01 22:04:06 +00:00
server.go internal/lsp/progress: detach context for all progress notifications 2022-06-02 20:26:04 +00:00
server_gen.go internal/lsp/progress: detach context for all progress notifications 2022-06-02 20:26:04 +00:00
signature_help.go
symbols.go internal/lsp: honor the file kind provided by clients for overlays 2022-01-13 20:54:45 +00:00
text_synchronization.go internal/lsp/progress: detach context for all progress notifications 2022-06-02 20:26:04 +00:00
workspace.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
workspace_symbol.go

README.md

lsp

internal/lsp provides much of the Language Server Protocol (lsp) implementation for gopls.

Documentation for users and contributors can be found in the gopls/doc directory.