Skip to content

Commit 9e439b1

Browse files
committed
do not set default property
1 parent 37a3496 commit 9e439b1

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/vs/platform/extensionManagement/common/extensionManagement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export interface IGalleryMetadata {
9292

9393
export interface ILocalExtension extends IExtension {
9494
readonly manifest: IExtensionManifest;
95-
isDefault: boolean;
95+
isDefault: boolean | undefined;
9696
publisherId: string | null;
9797
publisherDisplayName: string | null;
9898
readmeUrl: URI | null;

src/vs/platform/extensionManagement/node/extensionManagementService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
152152

153153
}
154154

155-
install(vsix: URI, isDefault: boolean = false): Promise<ILocalExtension> {
155+
install(vsix: URI, isDefault?: boolean): Promise<ILocalExtension> {
156156
this.logService.trace('ExtensionManagementService#install', vsix.toString());
157157
return createCancelablePromise(token => {
158158
return this.downloadVsix(vsix).then(downloadLocation => {
@@ -195,7 +195,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
195195
return this.getGalleryMetadata(getGalleryExtensionId(manifest.publisher, manifest.name))
196196
.then(
197197
metadata => this.installFromZipPath(identifierWithVersion, zipPath, { ...metadata, isDefault }, operation, token),
198-
() => this.installFromZipPath(identifierWithVersion, zipPath, { isDefault }, operation, token))
198+
() => this.installFromZipPath(identifierWithVersion, zipPath, isDefault ? { isDefault } : undefined, operation, token))
199199
.then(
200200
local => { this.logService.info('Successfully installed the extension:', identifier.id); return local; },
201201
e => {
@@ -219,7 +219,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
219219
return this.downloadService.download(vsix, URI.file(downloadedLocation)).then(() => URI.file(downloadedLocation));
220220
}
221221

222-
private installFromZipPath(identifierWithVersion: ExtensionIdentifierWithVersion, zipPath: string, metadata: IMetadata, operation: InstallOperation, token: CancellationToken): Promise<ILocalExtension> {
222+
private installFromZipPath(identifierWithVersion: ExtensionIdentifierWithVersion, zipPath: string, metadata: IMetadata | undefined, operation: InstallOperation, token: CancellationToken): Promise<ILocalExtension> {
223223
return this.toNonCancellablePromise(this.installExtension({ zipPath, identifierWithVersion, metadata }, token)
224224
.then(local => this.installDependenciesAndPackExtensions(local, undefined)
225225
.then(
@@ -288,7 +288,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
288288

289289
this.downloadInstallableExtension(extension, operation)
290290
.then(installableExtension => {
291-
installableExtension.metadata.isDefault = isDefault !== undefined ? isDefault : !!existingExtension?.isDefault;
291+
installableExtension.metadata.isDefault = isDefault !== undefined ? isDefault : existingExtension?.isDefault;
292292
return this.installExtension(installableExtension, cancellationToken)
293293
.then(local => this.extensionsDownloader.delete(URI.file(installableExtension.zipPath)).finally(() => { }).then(() => local));
294294
})

src/vs/platform/extensionManagement/node/extensionsScanner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const INSTALL_ERROR_EXTRACTING = 'extracting';
3232
const INSTALL_ERROR_DELETING = 'deleting';
3333
const INSTALL_ERROR_RENAMING = 'renaming';
3434

35-
export type IMetadata = Partial<IGalleryMetadata> & { isDefault: boolean; };
35+
export type IMetadata = Partial<IGalleryMetadata & { isDefault: boolean; }>;
3636

3737
export class ExtensionsScanner extends Disposable {
3838

@@ -229,7 +229,7 @@ export class ExtensionsScanner extends Disposable {
229229
const changelog = children.filter(child => /^changelog(\.txt|\.md|)$/i.test(child))[0];
230230
const changelogUrl = changelog ? URI.file(path.join(extensionPath, changelog)) : null;
231231
const identifier = { id: getGalleryExtensionId(manifest.publisher, manifest.name) };
232-
const local = <ILocalExtension>{ type, identifier, manifest, location: URI.file(extensionPath), readmeUrl, changelogUrl, publisherDisplayName: null, publisherId: null, isDefault: false };
232+
const local = <ILocalExtension>{ type, identifier, manifest, location: URI.file(extensionPath), readmeUrl, changelogUrl, publisherDisplayName: null, publisherId: null, isDefault: undefined };
233233
if (metadata) {
234234
this.setMetadata(local, metadata);
235235
}

0 commit comments

Comments
 (0)