src/goTestExplorer: handle weird doc URIs on load

For some reason, when VSCode initially opens a workspace, the
document(s) it passes to didOpenDocument have a 'git' scheme and end in
'.git'. This CL handles that special case, which means tests will be
recognized immediately in already open documents.

Change-Id: I4c8bc53f3923dad6287a54895e96298ef4162208
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/343490
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Peter Weinberger <pjw@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/src/goTestExplorer.ts b/src/goTestExplorer.ts
index 94a74a9..253f7a6 100644
--- a/src/goTestExplorer.ts
+++ b/src/goTestExplorer.ts
@@ -602,12 +602,13 @@
 
 // Handle opened documents, document changes, and file creation.
 async function documentUpdate(expl: TestExplorer, doc: TextDocument, ranges?: Range[]) {
-	if (!doc.uri.path.endsWith('_test.go')) {
-		return;
-	}
-
 	if (doc.uri.scheme === 'git') {
 		// TODO(firelizzard18): When a workspace is reopened, VSCode passes us git: URIs. Why?
+		const { path } = JSON.parse(doc.uri.query);
+		doc = await vscode.workspace.openTextDocument(path);
+	}
+
+	if (!doc.uri.path.endsWith('_test.go')) {
 		return;
 	}