gopls/internal/lsp: delay workspace diagnostics and analysis
Analysis runs its own type-checking, which we don't want to compete with
normal type-checking of active packages. Delay analysis along with
workspace-wide diagnostics, which seems like a reasonable trade-off.
Also, increase the diagnostics delay to 1s. We produce type-checking
errors for actively edited packages immediately, and the user will
probably not notice an additional delay to other diagnostics.
This change exposed a "bug" in the initial workspace load benchmark,
which opened a file, and therefore had multiple parallel diagnostics
passes running simultaneously. Remove the file opening.
Also: update the marker tests to set a short diagnostics delay, as
otherwise each test incurs this additional delay.
Change-Id: I886ef89f440a9ebae8e4e6d0d076e47c40b5cd04
Reviewed-on: https://go-review.googlesource.com/c/tools/+/476255
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
diff --git a/gopls/internal/lsp/source/api_json.go b/gopls/internal/lsp/source/api_json.go
old mode 100755
new mode 100644
index e655eb0..74d8d71
--- a/gopls/internal/lsp/source/api_json.go
+++ b/gopls/internal/lsp/source/api_json.go
@@ -509,7 +509,7 @@
Name: "diagnosticsDelay",
Type: "time.Duration",
Doc: "diagnosticsDelay controls the amount of time that gopls waits\nafter the most recent file modification before computing deep diagnostics.\nSimple diagnostics (parsing and type-checking) are always run immediately\non recently modified packages.\n\nThis option must be set to a valid duration string, for example `\"250ms\"`.\n",
- Default: "\"250ms\"",
+ Default: "\"1s\"",
Status: "advanced",
Hierarchy: "ui.diagnostic",
},