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 golang/vscode-go#1104

Change-Id: Id923719462b68972a79e3f7c32f54edba7462e46
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/285092
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/src/util.ts b/src/util.ts
index 04a7369..c84cc1e 100644
--- a/src/util.ts
+++ b/src/util.ts
@@ -904,7 +904,7 @@
 		}
 		// If there are errors from the language client that are on the current file, ignore the warnings co-inciding
 		// with them.
-		if (languageClient) {
+		if (languageClient && languageClient.diagnostics?.has(fileUri)) {
 			newDiagnostics = deDupeDiagnostics(languageClient.diagnostics.get(fileUri).slice(), newDiagnostics);
 		}
 		diagnosticCollection.set(fileUri, newDiagnostics);