Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions src/goDebugConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,33 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
debugConfiguration['currentFile'] =
activeEditor && activeEditor.document.languageId === 'go' && activeEditor.document.fileName;

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);
}
});
}
}