mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 17:22:45 -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));
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import { areSameExtensions, adoptToGalleryExtensionId, getGalleryExtensionId } f
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { getManifest } from 'vs/platform/extensionManagement/node/extensionManagementUtil';
|
||||
import { IExtensionManifest, ExtensionType, isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { isUIExtension } from 'vs/platform/extensions/node/extensionsUtil';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
@@ -69,10 +68,8 @@ export function getIdAndVersion(id: string): [string, string | undefined] {
|
||||
export class Main {
|
||||
|
||||
constructor(
|
||||
private readonly remote: boolean,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IEnvironmentService private readonly environmentService: IEnvironmentService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
|
||||
@IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService
|
||||
) { }
|
||||
@@ -138,10 +135,6 @@ export class Main {
|
||||
extension = path.isAbsolute(extension) ? extension : path.join(process.cwd(), extension);
|
||||
|
||||
const manifest = await getManifest(extension);
|
||||
if (this.remote && (!isLanguagePackExtension(manifest) && isUIExtension(manifest, [], this.configurationService))) {
|
||||
console.log(localize('notSupportedUIExtension', "Can't install extension {0} since UI Extensions are not supported", getBaseLabel(extension)));
|
||||
return null;
|
||||
}
|
||||
const valid = await this.validate(manifest, force);
|
||||
|
||||
if (valid) {
|
||||
@@ -180,11 +173,6 @@ export class Main {
|
||||
}
|
||||
|
||||
const manifest = await this.extensionGalleryService.getManifest(extension, CancellationToken.None);
|
||||
if (this.remote && manifest && (!isLanguagePackExtension(manifest) && isUIExtension(manifest, [], this.configurationService))) {
|
||||
console.log(localize('notSupportedUIExtension', "Can't install extension {0} since UI Extensions are not supported", extension.identifier.id));
|
||||
return null;
|
||||
}
|
||||
|
||||
const [installedExtension] = installed.filter(e => areSameExtensions(e.identifier, { id }));
|
||||
if (installedExtension) {
|
||||
if (extension.version === installedExtension.manifest.version) {
|
||||
@@ -312,7 +300,7 @@ export function main(argv: ParsedArgs): Promise<void> {
|
||||
const services = new ServiceCollection();
|
||||
services.set(IConfigurationService, new SyncDescriptor(ConfigurationService, [environmentService.appSettingsPath]));
|
||||
services.set(IRequestService, new SyncDescriptor(RequestService));
|
||||
services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService, [false]));
|
||||
services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
|
||||
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
|
||||
|
||||
const appenders: AppInsightsAppender[] = [];
|
||||
@@ -334,7 +322,7 @@ export function main(argv: ParsedArgs): Promise<void> {
|
||||
}
|
||||
|
||||
const instantiationService2 = instantiationService.createChild(services);
|
||||
const main = instantiationService2.createInstance(Main, false);
|
||||
const main = instantiationService2.createInstance(Main);
|
||||
|
||||
return main.run(argv).then(() => {
|
||||
// Dispose the AI adapter so that remaining data gets flushed.
|
||||
|
||||
Reference in New Issue
Block a user