Skip to content

Commit

Permalink
gopls/internal/lsp/cache: keep analysis progress reports on one line
Browse files Browse the repository at this point in the history
VS Code exposes only one line for progress reports; as pointed out in
golang/go#61352, multi-line reports cause a broken UI.

Fixes golang/go#61352

Change-Id: I0b5864f9a0dbb0bd9d191075b6c1cf0c7285f4bc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/513735
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
  • Loading branch information
findleyr committed Jul 27, 2023
1 parent e8cdaf4 commit 38606b3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions gopls/internal/lsp/cache/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ func (snapshot *snapshot) Analyze(ctx context.Context, pkgs map[PackageID]unit,
if now.Sub(lastReport) > reportEvery {
lastReport = now
// Trailing space is intentional: some LSP clients strip newlines.
msg := fmt.Sprintf(`Constructing index of analysis facts... (%d/%d packages).
(Set "analysisProgressReporting" to false to disable notifications.)`,
msg := fmt.Sprintf(`Indexed %d/%d packages. (Set "analysisProgressReporting" to false to disable notifications.)`,
completed, len(nodes))
pct := 100 * float64(completed) / float64(len(nodes))
wd.Report(ctx, msg, pct)
Expand Down

0 comments on commit 38606b3

Please sign in to comment.