src/goTest/profile: fix tree view action

Fixes opening a profile by clicking on it in the tree view.

Change-Id: Ide778e894e431b430ea2aad2451b4c043ac25289
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/440530
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/docs/commands.md b/docs/commands.md
index 094d325..2752332 100644
--- a/docs/commands.md
+++ b/docs/commands.md
@@ -79,6 +79,10 @@
 
 Delete selected profile
 
+### `Go: Show pprof file`
+
+Internal use. Open a pprof profile file.
+
 ### `Go: Benchmark Package`
 
 Runs all benchmarks in the package of the current file.
diff --git a/package.json b/package.json
index a23c306..ffcbe47 100644
--- a/package.json
+++ b/package.json
@@ -285,6 +285,11 @@
         "category": "Test"
       },
       {
+        "command": "go.test.showProfileFile",
+        "title": "Go: Show pprof file",
+        "description": "Internal use. Open a pprof profile file."
+      },
+      {
         "command": "go.benchmark.package",
         "title": "Go: Benchmark Package",
         "description": "Runs all benchmarks in the package of the current file."
@@ -2676,6 +2681,10 @@
           "when": "false"
         },
         {
+          "command": "go.test.showProfileFile",
+          "when": "false"
+        },
+        {
           "command": "go.explorer.refresh",
           "when": "false"
         },
diff --git a/src/goTest/explore.ts b/src/goTest/explore.ts
index 8fd016b..5493b0e 100644
--- a/src/goTest/explore.ts
+++ b/src/goTest/explore.ts
@@ -130,6 +130,12 @@
 		);
 
 		context.subscriptions.push(
+			vscode.commands.registerCommand('go.test.showProfileFile', async (file: Uri) => {
+				return inst.profiler.showFile(file.fsPath);
+			})
+		);
+
+		context.subscriptions.push(
 			workspace.onDidChangeConfiguration(async (x) => {
 				try {
 					await inst.didChangeConfiguration(x);
diff --git a/src/goTest/profile.ts b/src/goTest/profile.ts
index 78e57c9..e74c704 100644
--- a/src/goTest/profile.ts
+++ b/src/goTest/profile.ts
@@ -122,6 +122,10 @@
 		await runs[0].show();
 	}
 
+	showFile(file: string) {
+		return show(file);
+	}
+
 	// Tests that have been profiled
 	get tests() {
 		const items = Array.from(this.runs.keys());
@@ -298,7 +302,7 @@
 			item.contextValue = 'go:test:file';
 			item.command = {
 				title: 'Open',
-				command: 'vscode.open',
+				command: 'go.test.showProfileFile',
 				arguments: [element.uri]
 			};
 			return item;