Skip to content

Commit 7a2c835

Browse files
committed
extension/src/language: check token field existence before 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]>
1 parent 25da974 commit 7a2c835

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

extension/src/language/goLanguageServer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ export async function buildLanguageClient(
565565
}
566566
const res = await next(command, args);
567567

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

0 commit comments

Comments
 (0)