Skip to content

Commit

Permalink
[release-v0.46]extension/src/language: check token field existence be…
Browse files Browse the repository at this point in the history
…fore assertion

The error happens when the workspace/executeCommand returns results
without any token. vscode-go tried to assert the type of "Token"
field without checking for it's existence.

Command with token returned (gopls.vulncheck):
https://github.com/user-attachments/assets/931524ba-a40b-4a8c-b7af-a350a4c9a135

Command without token returned (gopls.upgrade_dependency):
https://github.com/user-attachments/assets/cb23c5bc-7d0b-4e60-aa4e-66ba1fed31d8

For #3698

Change-Id: I07183b7e0f30912a6b3f6c0ab53a40624ccd7880
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/654555
Reviewed-by: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
kokoro-CI: kokoro <[email protected]>
Reviewed-by: Madeline Kalil <[email protected]>
(cherry picked from commit 7a2c835)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/654775
  • Loading branch information
h9jiang committed Mar 4, 2025
1 parent 07561fd commit 17390e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion extension/src/language/goLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ export async function buildLanguageClient(
}
const res = await next(command, args);

const progressToken = <ProgressToken>res.Token;
const progressToken = res?.Token as ProgressToken;
// The progressToken from executeCommand indicates that
// gopls may trigger a related workDoneProgress
// notification, either before or after the command
Expand Down

0 comments on commit 17390e5

Please sign in to comment.