提交 268303bd 编写于 作者: R Rachel Macfarlane

Show prompt when closing issue reporter without submitting, fixes #64462

上级 4e0e4b85
......@@ -69,6 +69,7 @@ export class IssueReporter extends Disposable {
private receivedSystemInfo = false;
private receivedPerformanceInfo = false;
private shouldQueueSearch = false;
private hasBeenSubmitted = false;
private previewButton: Button;
......@@ -407,7 +408,14 @@ export class IssueReporter extends Disposable {
if (cmdOrCtrlKey && e.keyCode === 87) {
e.stopPropagation();
e.preventDefault();
ipcRenderer.send('vscode:closeIssueReporter');
const issueTitle = (<HTMLInputElement>document.getElementById('issue-title'))!.value;
const { issueDescription } = this.issueReporterModel.getData();
if (!this.hasBeenSubmitted && (issueTitle || issueDescription)) {
ipcRenderer.send('vscode:issueReporterConfirmClose');
} else {
ipcRenderer.send('vscode:closeIssueReporter');
}
}
// Cmd/Ctrl + zooms in
......@@ -780,6 +788,7 @@ export class IssueReporter extends Disposable {
}
*/
this.telemetryService.publicLog('issueReporterSubmit', { issueType: this.issueReporterModel.getData().issueType, numSimilarIssuesDisplayed: this.numberOfSearchResultsDisplayed });
this.hasBeenSubmitted = true;
const baseUrl = this.getIssueUrlWithTitle((<HTMLInputElement>document.getElementById('issue-title')).value);
const issueBody = this.issueReporterModel.serialize();
......
......@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
import * as objects from 'vs/base/common/objects';
import { parseArgs } from 'vs/platform/environment/node/argv';
import { IIssueService, IssueReporterData, IssueReporterFeatures, ProcessExplorerData } from 'vs/platform/issue/common/issue';
import { BrowserWindow, ipcMain, screen, Event } from 'electron';
import { BrowserWindow, ipcMain, screen, Event, dialog } from 'electron';
import { ILaunchService } from 'vs/platform/launch/electron-main/launchService';
import { PerformanceInfo, SystemInfo, IDiagnosticsService } from 'vs/platform/diagnostics/electron-main/diagnosticsService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
......@@ -50,6 +50,24 @@ export class IssueService implements IIssueService {
});
});
ipcMain.on('vscode:issueReporterConfirmClose', (_) => {
const messageOptions = {
message: localize('confirmCloseIssueReporter', "Your input will not be saved. Are you sure you want to close this window?"),
type: 'warning',
buttons: [
localize('yes', "Yes"),
localize('cancel', "Cancel")
]
};
dialog.showMessageBox(this._issueWindow, messageOptions, (response) => {
if (response === 0) {
this._issueWindow.destroy();
this._issueWindow = null;
}
});
});
ipcMain.on('vscode:workbenchCommand', (_, commandInfo) => {
const { id, from, args } = commandInfo;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册