diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 466cf56ea..2e9768d5c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -27,7 +27,7 @@ Please answer these questions before submitting your issue. Thanks! - - Check your installed extensions to get the version of the VS Code Go extension - -- 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 - ### Share the Go related settings you have added/edited diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index c83a2a037..35447a552 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -305,9 +305,16 @@ function logError(...args: any[]) { 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 @@ class GoDebugSession extends LoggingDebugSession { 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 @@ class GoDebugSession extends LoggingDebugSession { 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 @@ class GoDebugSession extends LoggingDebugSession { } 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 9f4e3ff33..a2be111ca 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -360,11 +360,18 @@ export async function promptForUpdatingTool(toolName: string) { } 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;