Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf - use a fast affects call to reduce event spam #169491

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { ExtensionsManifestCache } from 'vs/platform/extensionManagement/node/ex
import { DidChangeProfileExtensionsEvent, ExtensionsWatcher } from 'vs/platform/extensionManagement/node/extensionsWatcher';
import { ExtensionType, IExtension, IExtensionManifest, isApplicationScopedExtension, TargetPlatform } from 'vs/platform/extensions/common/extensions';
import { isEngineValid } from 'vs/platform/extensions/common/extensionValidator';
import { FileChangesEvent, IFileService } from 'vs/platform/files/common/files';
import { FileChangesEvent, FileChangeType, IFileService } from 'vs/platform/files/common/files';
import { IInstantiationService, refineServiceDecorator } from 'vs/platform/instantiation/common/instantiation';
import { ILogService } from 'vs/platform/log/common/log';
import { IProductService } from 'vs/platform/product/common/productService';
Expand Down Expand Up @@ -314,6 +314,10 @@ export class ExtensionManagementService extends AbstractExtensionManagementServi
}

private async onDidFilesChange(e: FileChangesEvent): Promise<void> {
if (!e.affects(this.extensionsScannerService.userExtensionsLocation, FileChangeType.ADDED)) {
return;
}

const added: ILocalExtension[] = [];
for (const resource of e.rawAdded) {
// Check if this is a known directory
Expand Down
9 changes: 0 additions & 9 deletions src/vs/platform/files/common/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ export class FileChangesEvent {
private readonly deleted: TernarySearchTree<URI, IFileChange> | undefined = undefined;

constructor(changes: readonly IFileChange[], ignorePathCasing: boolean) {
this.rawChanges = changes;

const entriesByType = new Map<FileChangeType, [URI, IFileChange][]>();

Expand Down Expand Up @@ -901,14 +900,6 @@ export class FileChangesEvent {
return !!this.updated;
}

/**
* @deprecated use the `contains` or `affects` method to efficiently find
* out if the event relates to a given resource. these methods ensure:
* - that there is no expensive lookup needed (by using a `TernarySearchTree`)
* - correctly handles `FileChangeType.DELETED` events
*/
readonly rawChanges: readonly IFileChange[] = [];

/**
* @deprecated use the `contains` or `affects` method to efficiently find
* out if the event relates to a given resource. these methods ensure:
Expand Down
1 change: 0 additions & 1 deletion src/vs/platform/files/test/common/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ suite('Files', () => {
assert.strictEqual(1, event.rawAdded.length);
assert.strictEqual(2, event.rawUpdated.length);
assert.strictEqual(3, event.rawDeleted.length);
assert.strictEqual(6, event.rawChanges.length);
assert.strictEqual(true, event.gotAdded());
assert.strictEqual(true, event.gotUpdated());
assert.strictEqual(true, event.gotDeleted());
Expand Down