Skip to content

Commit 3806624

Browse files
committed
sync: merge microsoft/vscode-go@79a6b01 into master
Change-Id: I834c9ec6b943eeed761c5fd4bbcca78c93d1c892
2 parents 39dadee + 79a6b01 commit 3806624

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

src/debugAdapter/goDebug.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ class Delve {
435435
runOptions.cwd = program;
436436
runArgs.push('.');
437437
} else {
438+
runOptions.cwd = dirname;
438439
runArgs.push(program);
439440
}
440441
if (launchArgs.args) {

src/goDebugConfiguration.ts

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
4747
return;
4848
}
4949

50-
debugConfiguration = {
50+
debugConfiguration = Object.assign(debugConfiguration || {}, {
5151
name: 'Launch',
5252
type: 'go',
5353
request: 'launch',
5454
mode: 'auto',
5555
program: activeEditor.document.fileName
56-
};
56+
});
5757
}
5858

5959
debugConfiguration['packagePathToGoModPathMap'] = packagePathToGoModPathMap;
@@ -110,25 +110,33 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
110110
activeEditor && activeEditor.document.fileName.endsWith('_test.go') ? 'test' : 'debug';
111111
}
112112

113-
const neverAgain = { title: `Don't Show Again` };
114-
const ignoreWarningKey = 'ignoreDebugLaunchRemoteWarning';
115-
const ignoreWarning = getFromGlobalState(ignoreWarningKey);
116-
if (
117-
ignoreWarning !== true &&
118-
debugConfiguration.request === 'launch' &&
119-
debugConfiguration['mode'] === 'remote'
120-
) {
121-
vscode.window
122-
.showWarningMessage(
123-
`Request type of 'launch' with mode 'remote' is deprecated, please use request type 'attach' with mode 'remote' instead.`,
124-
neverAgain
125-
)
126-
.then((result) => {
127-
if (result === neverAgain) {
128-
updateGlobalState(ignoreWarningKey, true);
129-
}
130-
});
113+
if (debugConfiguration.request === 'launch' && debugConfiguration['mode'] === 'remote') {
114+
this.showWarning(
115+
'ignoreDebugLaunchRemoteWarning',
116+
`Request type of 'launch' with mode 'remote' is deprecated, please use request type 'attach' with mode 'remote' instead.`);
117+
}
118+
119+
if (debugConfiguration.request === 'attach'
120+
&& debugConfiguration['mode'] === 'remote'
121+
&& debugConfiguration['program']) {
122+
this.showWarning(
123+
'ignoreUsingRemotePathAndProgramWarning',
124+
`Request type of 'attach' with mode 'remote' does not work with 'program' attribute, please use 'cwd' attribute instead.`);
131125
}
132126
return debugConfiguration;
133127
}
128+
129+
private showWarning(ignoreWarningKey: string, warningMessage: string) {
130+
const ignoreWarning = getFromGlobalState(ignoreWarningKey);
131+
if (ignoreWarning) {
132+
return;
133+
}
134+
135+
const neverAgain = { title: 'Don\'t Show Again' };
136+
vscode.window.showWarningMessage(warningMessage, neverAgain).then((result) => {
137+
if (result === neverAgain) {
138+
updateGlobalState(ignoreWarningKey, true);
139+
}
140+
});
141+
}
134142
}

0 commit comments

Comments
 (0)