Sync @ 7da5077

 Merge 'microsoft/vscode-go/master' into 'golang/vscode-go/master'

    Sync @ 7da5077

    * master:
      Address mismatch on path separators in debug config (#2010) (#3108)
      Include the link to release note/package overview in the update prompt, and update gopls default version (#3041)
      bug_report.md: Fix "architecture" typo. (#3095)
      telemetry.ts: send telemetry only if aiKey is not an empty  string(#3091)

Change-Id: I727ef0ed3b8d1ad926e26831534c153b06070e64
GitHub-Last-Rev: d11e34231dd5d461dfe520d78b9bdc62b6781782
GitHub-Pull-Request: golang/vscode-go#11
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/224239
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 466cf56..2e9768d 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -27,7 +27,7 @@
 	- <Paste VS Code version here>
 - Check your installed extensions to get the version of the VS Code Go extension 
 	- <Paste Go extension version here>
-- Run `go env GOOS GOARCH` to get the operating system and processor arhcitecture details
+- Run `go env GOOS GOARCH` to get the operating system and processor architecture details
 	- <Paste OS and arch details here>
 
 ### Share the Go related settings you have added/edited
diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts
index c83a2a0..35447a5 100644
--- a/src/debugAdapter/goDebug.ts
+++ b/src/debugAdapter/goDebug.ts
@@ -305,9 +305,16 @@
 	logger.error(logArgsToString(args));
 }
 
+function findPathSeparator(filePath: string) {
+	return filePath.includes('/') ? '/' : '\\';
+}
+
 function normalizePath(filePath: string) {
 	if (process.platform === 'win32') {
+		const pathSeparator = findPathSeparator(filePath);
 		filePath = path.normalize(filePath);
+		// Normalize will replace everything with backslash on Windows.
+		filePath = filePath.replace(/\\/g, pathSeparator);
 		return fixDriveCasingInWindows(filePath);
 	}
 	return filePath;
@@ -754,13 +761,6 @@
 		log('InitializeResponse');
 	}
 
-	protected findPathSeperator(filePath: string) {
-		if (/^(\w:[\\/]|\\\\)/.test(filePath)) {
-			return '\\';
-		}
-		return filePath.includes('/') ? '/' : '\\';
-	}
-
 	protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
 		if (!args.program) {
 			this.sendErrorResponse(
@@ -835,10 +835,12 @@
 		if (this.delve.remotePath.length === 0) {
 			return this.convertClientPathToDebugger(filePath);
 		}
+		// The filePath may have a different path separator than the localPath
+		// So, update it to use the same separator as the remote path to ease
+		// in replacing the local path in it with remote path
+		filePath = filePath.replace(/\/|\\/g, this.remotePathSeparator);
 		return filePath
-			.replace(this.delve.program, this.delve.remotePath)
-			.split(this.localPathSeparator)
-			.join(this.remotePathSeparator);
+			.replace(this.delve.program.replace(/\/|\\/g, this.remotePathSeparator), this.delve.remotePath);
 	}
 
 	protected toLocalPath(pathToConvert: string): string {
@@ -1392,8 +1394,8 @@
 		}
 
 		if (args.remotePath.length > 0) {
-			this.localPathSeparator = this.findPathSeperator(localPath);
-			this.remotePathSeparator = this.findPathSeperator(args.remotePath);
+			this.localPathSeparator = findPathSeparator(localPath);
+			this.remotePathSeparator = findPathSeparator(args.remotePath);
 
 			const llist = localPath.split(/\/|\\/).reverse();
 			const rlist = args.remotePath.split(/\/|\\/).reverse();
diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts
index 9f4e3ff..a2be111 100644
--- a/src/goInstallTools.ts
+++ b/src/goInstallTools.ts
@@ -360,11 +360,18 @@
 	}
 	const goVersion = await getGoVersion();
 	const updateMsg = `Your version of ${tool.name} appears to be out of date. Please update for an improved experience.`;
-	vscode.window.showInformationMessage(updateMsg, 'Update').then((selected) => {
+	const choices: string[] = ['Update'];
+	if (toolName === `gopls`) {
+		choices.push('Release Notes');  // TODO(hyangah): pass more info such as version, release note location.
+	}
+	vscode.window.showInformationMessage(updateMsg, ...choices).then((selected) => {
 		switch (selected) {
 			case 'Update':
 				installTools([tool], goVersion);
 				break;
+			case 'Release Notes':
+				vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://github.com/golang/go/issues/33030#issuecomment-510151934'));
+				break;
 			default:
 				declinedUpdates.push(tool);
 				break;