mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
Merge from vscode 5b9869eb02fa4c96205a74d05cad9164dfd06d60 (#5607)
This commit is contained in:
@@ -42,7 +42,7 @@ import { Button } from 'vs/base/browser/ui/button/button';
|
||||
import { withUndefinedAsNull } from 'vs/base/common/types';
|
||||
import { SystemInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnosticsService';
|
||||
|
||||
const MAX_URL_LENGTH = platform.isWindows ? 2081 : 5400;
|
||||
const MAX_URL_LENGTH = 2045;
|
||||
|
||||
interface SearchResult {
|
||||
html_url: string;
|
||||
@@ -440,11 +440,11 @@ export class IssueReporter extends Disposable {
|
||||
}
|
||||
});
|
||||
|
||||
document.onkeydown = (e: KeyboardEvent) => {
|
||||
document.onkeydown = async (e: KeyboardEvent) => {
|
||||
const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
|
||||
// Cmd/Ctrl+Enter previews issue and closes window
|
||||
if (cmdOrCtrlKey && e.keyCode === 13) {
|
||||
if (this.createIssue()) {
|
||||
if (await this.createIssue()) {
|
||||
ipcRenderer.send('vscode:closeIssueReporter');
|
||||
}
|
||||
}
|
||||
@@ -844,7 +844,7 @@ export class IssueReporter extends Disposable {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
private createIssue(): boolean {
|
||||
private async createIssue(): Promise<boolean> {
|
||||
if (!this.validateInputs()) {
|
||||
// If inputs are invalid, set focus to the first one and add listeners on them
|
||||
// to detect further changes
|
||||
@@ -888,14 +888,32 @@ export class IssueReporter extends Disposable {
|
||||
let url = baseUrl + `&body=${encodeURIComponent(issueBody)}`;
|
||||
|
||||
if (url.length > MAX_URL_LENGTH) {
|
||||
clipboard.writeText(issueBody);
|
||||
url = baseUrl + `&body=${encodeURIComponent(localize('pasteData', "We have written the needed data into your clipboard because it was too large to send. Please paste."))}`;
|
||||
try {
|
||||
url = await this.writeToClipboard(baseUrl, issueBody);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ipcRenderer.send('vscode:openExternal', url);
|
||||
return true;
|
||||
}
|
||||
|
||||
private async writeToClipboard(baseUrl: string, issueBody: string): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcRenderer.once('vscode:issueReporterClipboardResponse', (_: unknown, shouldWrite: boolean) => {
|
||||
if (shouldWrite) {
|
||||
clipboard.writeText(issueBody);
|
||||
resolve(baseUrl + `&body=${encodeURIComponent(localize('pasteData', "We have written the needed data into your clipboard because it was too large to send. Please paste."))}`);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
|
||||
ipcRenderer.send('vscode:issueReporterClipboard');
|
||||
});
|
||||
}
|
||||
|
||||
private getExtensionGitHubUrl(): string {
|
||||
let repositoryUrl = '';
|
||||
const bugsUrl = this.getExtensionBugsUrl();
|
||||
|
||||
@@ -144,7 +144,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
||||
}
|
||||
server.registerChannel('telemetryAppender', new TelemetryAppenderChannel(appInsightsAppender));
|
||||
|
||||
services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService, [false]));
|
||||
services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
|
||||
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
|
||||
services.set(ILocalizationsService, new SyncDescriptor(LocalizationsService));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user