Revert "Sync @ 7da5077"
This reverts commit 19896f52086c2f6a4ca44758e2a86c6a18271991.
Reason for revert: external commits were not properly imported. All commits were squashed into one and history was lost.
Change-Id: Ie8f1ca0cb53bd9dfaa8abf078ce261c92b79b845
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/224942
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 2e9768d..466cf56 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 architecture details
+- Run `go env GOOS GOARCH` to get the operating system and processor arhcitecture 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 35447a5..c83a2a0 100644
--- a/src/debugAdapter/goDebug.ts
+++ b/src/debugAdapter/goDebug.ts
@@ -305,16 +305,9 @@
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;
@@ -761,6 +754,13 @@
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,12 +835,10 @@
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.replace(/\/|\\/g, this.remotePathSeparator), this.delve.remotePath);
+ .replace(this.delve.program, this.delve.remotePath)
+ .split(this.localPathSeparator)
+ .join(this.remotePathSeparator);
}
protected toLocalPath(pathToConvert: string): string {
@@ -1394,8 +1392,8 @@
}
if (args.remotePath.length > 0) {
- this.localPathSeparator = findPathSeparator(localPath);
- this.remotePathSeparator = findPathSeparator(args.remotePath);
+ this.localPathSeparator = this.findPathSeperator(localPath);
+ this.remotePathSeparator = this.findPathSeperator(args.remotePath);
const llist = localPath.split(/\/|\\/).reverse();
const rlist = args.remotePath.split(/\/|\\/).reverse();
diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts
index a2be111..9f4e3ff 100644
--- a/src/goInstallTools.ts
+++ b/src/goInstallTools.ts
@@ -360,18 +360,11 @@
}
const goVersion = await getGoVersion();
const updateMsg = `Your version of ${tool.name} appears to be out of date. Please update for an improved experience.`;
- 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) => {
+ vscode.window.showInformationMessage(updateMsg, 'Update').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;