LocalizationService.update no longer needed. Fixes https://github.com/microsoft/vssaas-planning/issues/3290

This commit is contained in:
Martin Aeschlimann 2021-03-26 12:14:47 +01:00
parent 70aab480c5
commit 1eb987f85f
4 changed files with 10 additions and 26 deletions

View file

@ -10,11 +10,10 @@ import { URI } from 'vs/base/common/uri';
import { gt } from 'vs/base/common/semver/semver';
import { CLIOutput, IExtensionGalleryService, IExtensionManagementCLIService, IExtensionManagementService, IGalleryExtension, ILocalExtension, InstallOptions } from 'vs/platform/extensionManagement/common/extensionManagement';
import { adoptToGalleryExtensionId, areSameExtensions, getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { ExtensionType, EXTENSION_CATEGORIES, IExtensionManifest, isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
import { ExtensionType, EXTENSION_CATEGORIES, IExtensionManifest } from 'vs/platform/extensions/common/extensions';
import { getBaseLabel } from 'vs/base/common/labels';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Schemas } from 'vs/base/common/network';
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
const notFound = (id: string) => localize('notFound', "Extension '{0}' not found.", id);
const useId = localize('useId', "Make sure you use the full extension ID, including the publisher, e.g.: {0}", 'ms-dotnettools.csharp');
@ -47,8 +46,7 @@ export class ExtensionManagementCLIService implements IExtensionManagementCLISer
constructor(
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
@IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService,
@ILocalizationsService private readonly localizationsService: ILocalizationsService
@IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService
) { }
protected get location(): string | undefined {
@ -170,10 +168,6 @@ export class ExtensionManagementCLIService implements IExtensionManagementCLISer
}
if (installedExtensionsManifests.some(manifest => isLanguagePackExtension(manifest))) {
await this.updateLocalizationsCache();
}
if (failed.length) {
throw new Error(localize('installation failed', "Failed Installing Extensions: {0}", failed.join(', ')));
}
@ -315,10 +309,6 @@ export class ExtensionManagementCLIService implements IExtensionManagementCLISer
}
}
if (uninstalledExtensions.some(e => isLanguagePackExtension(e.manifest))) {
await this.updateLocalizationsCache();
}
}
public async locateExtension(extensions: string[], output: CLIOutput = console): Promise<void> {
@ -335,11 +325,6 @@ export class ExtensionManagementCLIService implements IExtensionManagementCLISer
});
}
private updateLocalizationsCache(): Promise<boolean> {
return this.localizationsService.update();
}
private notInstalled(id: string) {
return this.location ? localize('notInstalleddOnLocation', "Extension '{0}' is not installed on {1}.", id, this.location) : localize('notInstalled', "Extension '{0}' is not installed.", id);
}

View file

@ -25,8 +25,6 @@ export interface ILocalizationsService {
readonly onDidLanguagesChange: Event<void>;
getLanguageIds(): Promise<string[]>;
update(): Promise<boolean>;
}
export function isValidLocalization(localization: ILocalization): boolean {

View file

@ -15,7 +15,6 @@ import { getExtensionId } from 'vs/platform/extensionManagement/common/extension
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { ILabelService } from 'vs/platform/label/common/label';
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IProductService } from 'vs/platform/product/common/productService';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
@ -85,11 +84,10 @@ class RemoteExtensionCLIManagementService extends ExtensionManagementCLIService
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionGalleryService extensionGalleryService: IExtensionGalleryService,
@ILocalizationsService localizationsService: ILocalizationsService,
@ILabelService labelService: ILabelService,
@IWorkbenchEnvironmentService envService: IWorkbenchEnvironmentService
) {
super(extensionManagementService, extensionGalleryService, localizationsService);
super(extensionManagementService, extensionGalleryService);
const remoteAuthority = envService.remoteAuthority;
this._location = remoteAuthority ? labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority) : undefined;

View file

@ -166,7 +166,6 @@ export class CLIServerBase {
}
private async manageExtensions(data: ExtensionManagementPipeArgs, res: http.ServerResponse) {
console.log('server: manageExtensions');
try {
const toExtOrVSIX = (inputs: string[] | undefined) => inputs?.map(input => /\.vsix$/i.test(input) ? URI.parse(input) : input);
const commandArgs = {
@ -175,12 +174,16 @@ export class CLIServerBase {
uninstall: toExtOrVSIX(data.uninstall),
force: data.force
};
const output = await this._commands.executeCommand('_remoteCLI.manageExtensions', commandArgs, { allowTunneling: true });
const output = await this._commands.executeCommand('_remoteCLI.manageExtensions', commandArgs);
res.writeHead(200);
res.write(output);
} catch (e) {
} catch (err) {
res.writeHead(500);
res.write(String(e));
res.write(String(err), err => {
if (err) {
this.logService.error(err);
}
});
}
res.end();
}