sync: merge microsoft/vscode-go@79a6b01 into master
Change-Id: I834c9ec6b943eeed761c5fd4bbcca78c93d1c892
diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts
index a9a309e..98bdbd0 100644
--- a/src/debugAdapter/goDebug.ts
+++ b/src/debugAdapter/goDebug.ts
@@ -435,6 +435,7 @@
runOptions.cwd = program;
runArgs.push('.');
} else {
+ runOptions.cwd = dirname;
runArgs.push(program);
}
if (launchArgs.args) {
diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts
index e4cad2a..f9fe07c 100644
--- a/src/goDebugConfiguration.ts
+++ b/src/goDebugConfiguration.ts
@@ -47,13 +47,13 @@
return;
}
- debugConfiguration = {
+ debugConfiguration = Object.assign(debugConfiguration || {}, {
name: 'Launch',
type: 'go',
request: 'launch',
mode: 'auto',
program: activeEditor.document.fileName
- };
+ });
}
debugConfiguration['packagePathToGoModPathMap'] = packagePathToGoModPathMap;
@@ -110,25 +110,33 @@
activeEditor && activeEditor.document.fileName.endsWith('_test.go') ? 'test' : 'debug';
}
- const neverAgain = { title: `Don't Show Again` };
- const ignoreWarningKey = 'ignoreDebugLaunchRemoteWarning';
- const ignoreWarning = getFromGlobalState(ignoreWarningKey);
- if (
- ignoreWarning !== true &&
- debugConfiguration.request === 'launch' &&
- debugConfiguration['mode'] === 'remote'
- ) {
- vscode.window
- .showWarningMessage(
- `Request type of 'launch' with mode 'remote' is deprecated, please use request type 'attach' with mode 'remote' instead.`,
- neverAgain
- )
- .then((result) => {
- if (result === neverAgain) {
- updateGlobalState(ignoreWarningKey, true);
- }
- });
+ if (debugConfiguration.request === 'launch' && debugConfiguration['mode'] === 'remote') {
+ this.showWarning(
+ 'ignoreDebugLaunchRemoteWarning',
+ `Request type of 'launch' with mode 'remote' is deprecated, please use request type 'attach' with mode 'remote' instead.`);
+ }
+
+ if (debugConfiguration.request === 'attach'
+ && debugConfiguration['mode'] === 'remote'
+ && debugConfiguration['program']) {
+ this.showWarning(
+ 'ignoreUsingRemotePathAndProgramWarning',
+ `Request type of 'attach' with mode 'remote' does not work with 'program' attribute, please use 'cwd' attribute instead.`);
}
return debugConfiguration;
}
+
+ private showWarning(ignoreWarningKey: string, warningMessage: string) {
+ const ignoreWarning = getFromGlobalState(ignoreWarningKey);
+ if (ignoreWarning) {
+ return;
+ }
+
+ const neverAgain = { title: 'Don\'t Show Again' };
+ vscode.window.showWarningMessage(warningMessage, neverAgain).then((result) => {
+ if (result === neverAgain) {
+ updateGlobalState(ignoreWarningKey, true);
+ }
+ });
+ }
}