mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Remove extraneous boolean (#14500)
This commit is contained in:
parent
8e5cf5a990
commit
949dc8c893
|
@ -9,19 +9,19 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
|||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export interface IExtensionDescription {
|
||||
id: string;
|
||||
name: string;
|
||||
version: string;
|
||||
publisher: string;
|
||||
isBuiltin: boolean;
|
||||
extensionFolderPath: string;
|
||||
extensionDependencies?: string[];
|
||||
activationEvents?: string[];
|
||||
engines: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly version: string;
|
||||
readonly publisher: string;
|
||||
readonly isBuiltin: boolean;
|
||||
readonly extensionFolderPath: string;
|
||||
readonly extensionDependencies?: string[];
|
||||
readonly activationEvents?: string[];
|
||||
readonly engines: {
|
||||
vscode: string;
|
||||
};
|
||||
main?: string;
|
||||
contributes?: { [point: string]: any; };
|
||||
readonly main?: string;
|
||||
readonly contributes?: { [point: string]: any; };
|
||||
}
|
||||
|
||||
export interface IActivationEventListener {
|
||||
|
@ -69,10 +69,9 @@ export interface IExtensionsRuntimeService {
|
|||
_serviceBrand: any;
|
||||
|
||||
/**
|
||||
* if `includeDisabled` is `true` returns all extensions otherwise
|
||||
* returns only enabled extensions
|
||||
* Scans and returns only enabled extensions.
|
||||
*/
|
||||
getExtensions(includeDisabled?: boolean): TPromise<IExtensionDescription[]>;
|
||||
getExtensions(): TPromise<IExtensionDescription[]>;
|
||||
|
||||
/**
|
||||
* Returns `true` if given extension is disabled, otherwise `false`.
|
||||
|
|
|
@ -198,7 +198,21 @@ class ExtensionManifestNLSReplacer extends ExtensionManifestHandler {
|
|||
}
|
||||
|
||||
class ExtensionManifestValidator extends ExtensionManifestHandler {
|
||||
validate(extensionDescription: IExtensionDescription): IExtensionDescription {
|
||||
validate(_extensionDescription: IExtensionDescription): IExtensionDescription {
|
||||
// Relax the readonly properties here, it is the one place where we check and normalize values
|
||||
interface IRelaxedExtensionDescription {
|
||||
id: string;
|
||||
name: string;
|
||||
version: string;
|
||||
publisher: string;
|
||||
isBuiltin: boolean;
|
||||
extensionFolderPath: string;
|
||||
engines: {
|
||||
vscode: string;
|
||||
};
|
||||
main?: string;
|
||||
}
|
||||
let extensionDescription = <IRelaxedExtensionDescription>_extensionDescription;
|
||||
extensionDescription.isBuiltin = this._isBuiltin;
|
||||
|
||||
let notices: string[] = [];
|
||||
|
|
|
@ -47,13 +47,10 @@ export class ExtensionsRuntimeService implements IExtensionsRuntimeService {
|
|||
extensionManagementService.onDidUninstallExtension(this.onDidUninstallExtension, this, this.disposables);
|
||||
}
|
||||
|
||||
public getExtensions(includeDisabled: boolean = false): TPromise<IExtensionDescription[]> {
|
||||
public getExtensions(): TPromise<IExtensionDescription[]> {
|
||||
if (!this.installedExtensions) {
|
||||
this.installedExtensions = this.scanExtensions();
|
||||
}
|
||||
if (includeDisabled) {
|
||||
return this.installedExtensions;
|
||||
}
|
||||
return this.installedExtensions.then(extensionDescriptions => {
|
||||
const disabledExtensions = this.getDisabledExtensions();
|
||||
return disabledExtensions.length ? extensionDescriptions.filter(e => disabledExtensions.indexOf(`${e.publisher}.${e.name}`) === -1) : extensionDescriptions;
|
||||
|
|
Loading…
Reference in a new issue