mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ILocalizationsService, LanguageType } from 'vs/platform/localizations/common/localizations';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export class LocalizationsService implements ILocalizationsService {
|
||||
|
||||
_serviceBrand: ServiceIdentifier<any>;
|
||||
|
||||
private channel: IChannel;
|
||||
|
||||
constructor(@ISharedProcessService sharedProcessService: ISharedProcessService) {
|
||||
this.channel = sharedProcessService.getChannel('localizations');
|
||||
}
|
||||
|
||||
get onDidLanguagesChange(): Event<void> { return this.channel.listen('onDidLanguagesChange'); }
|
||||
|
||||
getLanguageIds(type?: LanguageType): Promise<string[]> {
|
||||
return this.channel.call('getLanguageIds', type);
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,11 @@ import { Queue } from 'vs/base/common/async';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { isValidLocalization, ILocalizationsService, LanguageType } from 'vs/platform/localizations/common/localizations';
|
||||
import product from 'vs/platform/node/product';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { distinct, equals } from 'vs/base/common/arrays';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { posix } from 'path';
|
||||
import { join } from 'vs/base/common/path';
|
||||
|
||||
interface ILanguagePack {
|
||||
hash: string;
|
||||
@@ -51,8 +51,6 @@ export class LocalizationsService extends Disposable implements ILocalizationsSe
|
||||
|
||||
this._register(extensionManagementService.onDidInstallExtension(({ local }) => this.onDidInstallExtension(local)));
|
||||
this._register(extensionManagementService.onDidUninstallExtension(({ identifier }) => this.onDidUninstallExtension(identifier)));
|
||||
|
||||
this.extensionManagementService.getInstalled().then(installed => this.cache.update(installed));
|
||||
}
|
||||
|
||||
getLanguageIds(type: LanguageType): Promise<string[]> {
|
||||
@@ -69,7 +67,7 @@ export class LocalizationsService extends Disposable implements ILocalizationsSe
|
||||
private onDidInstallExtension(extension: ILocalExtension | undefined): void {
|
||||
if (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) {
|
||||
this.logService.debug('Adding language packs from the extension', extension.identifier.id);
|
||||
this.update();
|
||||
this.update().then(changed => { if (changed) { this._onDidLanguagesChange.fire(); } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,19 +76,15 @@ export class LocalizationsService extends Disposable implements ILocalizationsSe
|
||||
.then(languagePacks => {
|
||||
if (Object.keys(languagePacks).some(language => languagePacks[language] && languagePacks[language].extensions.some(e => areSameExtensions(e.extensionIdentifier, identifier)))) {
|
||||
this.logService.debug('Removing language packs from the extension', identifier.id);
|
||||
this.update();
|
||||
this.update().then(changed => { if (changed) { this._onDidLanguagesChange.fire(); } });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private update(): void {
|
||||
Promise.all([this.cache.getLanguagePacks(), this.extensionManagementService.getInstalled()])
|
||||
update(): Promise<boolean> {
|
||||
return Promise.all([this.cache.getLanguagePacks(), this.extensionManagementService.getInstalled()])
|
||||
.then(([current, installed]) => this.cache.update(installed)
|
||||
.then(updated => {
|
||||
if (!equals(Object.keys(current), Object.keys(updated))) {
|
||||
this._onDidLanguagesChange.fire();
|
||||
}
|
||||
}));
|
||||
.then(updated => !equals(Object.keys(current), Object.keys(updated))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,19 +93,20 @@ class LanguagePacksCache extends Disposable {
|
||||
private languagePacks: { [language: string]: ILanguagePack } = {};
|
||||
private languagePacksFilePath: string;
|
||||
private languagePacksFileLimiter: Queue<any>;
|
||||
private initializedCache: boolean;
|
||||
|
||||
constructor(
|
||||
@IEnvironmentService environmentService: IEnvironmentService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
) {
|
||||
super();
|
||||
this.languagePacksFilePath = posix.join(environmentService.userDataPath, 'languagepacks.json');
|
||||
this.languagePacksFilePath = join(environmentService.userDataPath, 'languagepacks.json');
|
||||
this.languagePacksFileLimiter = new Queue();
|
||||
}
|
||||
|
||||
getLanguagePacks(): Promise<{ [language: string]: ILanguagePack }> {
|
||||
// if queue is not empty, fetch from disk
|
||||
if (this.languagePacksFileLimiter.size) {
|
||||
if (this.languagePacksFileLimiter.size || !this.initializedCache) {
|
||||
return this.withLanguagePacks()
|
||||
.then(() => this.languagePacks);
|
||||
}
|
||||
@@ -151,7 +146,7 @@ class LanguagePacksCache extends Disposable {
|
||||
languagePack.extensions.push({ extensionIdentifier, version: extension.manifest.version });
|
||||
}
|
||||
for (const translation of localizationContribution.translations) {
|
||||
languagePack.translations[translation.id] = posix.join(extension.location.fsPath, translation.path);
|
||||
languagePack.translations[translation.id] = join(extension.location.fsPath, translation.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,6 +176,7 @@ class LanguagePacksCache extends Disposable {
|
||||
}
|
||||
}
|
||||
this.languagePacks = languagePacks;
|
||||
this.initializedCache = true;
|
||||
const raw = JSON.stringify(this.languagePacks);
|
||||
this.logService.debug('Writing language packs', raw);
|
||||
return pfs.writeFile(this.languagePacksFilePath, raw);
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ILocalizationsService, LanguageType } from 'vs/platform/localizations/common/localizations';
|
||||
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
|
||||
|
||||
export class LocalizationsChannel implements IServerChannel {
|
||||
|
||||
@@ -31,16 +31,3 @@ export class LocalizationsChannel implements IServerChannel {
|
||||
throw new Error(`Call not found: ${command}`);
|
||||
}
|
||||
}
|
||||
|
||||
export class LocalizationsChannelClient implements ILocalizationsService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
constructor(private channel: IChannel) { }
|
||||
|
||||
get onDidLanguagesChange(): Event<void> { return this.channel.listen('onDidLanguagesChange'); }
|
||||
|
||||
getLanguageIds(type?: LanguageType): Promise<string[]> {
|
||||
return this.channel.call('getLanguageIds', type);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user