Skip to content

Commit 560cd9e

Browse files
committed
[release] src/util.ts: handle inactive languageClient
goLanguageServer's languageClient can be a valid language client, but isn't started yet. So, check if the diagnostic info is available and if there is any diagnostic for the given file uri before trying to start deduping. This addresses the exception thrown when the extension tries to access the undefined diagnostics. Another issue is the buildLanguageClient currently creates a non-nill languageClient object even when the language client doesn't need to be enabled. But that change is too subtle to be included in a patch release, so we don't address here. Fixes #1104 Change-Id: Id923719462b68972a79e3f7c32f54edba7462e46 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/285092 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> (cherry picked from commit 7f56895) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/285255
1 parent e988b14 commit 560cd9e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ export function handleDiagnosticErrors(
904904
}
905905
// If there are errors from the language client that are on the current file, ignore the warnings co-inciding
906906
// with them.
907-
if (languageClient) {
907+
if (languageClient && languageClient.diagnostics?.has(fileUri)) {
908908
newDiagnostics = deDupeDiagnostics(languageClient.diagnostics.get(fileUri).slice(), newDiagnostics);
909909
}
910910
diagnosticCollection.set(fileUri, newDiagnostics);

0 commit comments

Comments
 (0)