This commit is contained in:
Robert Jin 2021-11-10 23:35:46 +00:00
parent 9f45a29f48
commit d9e12ce615
2 changed files with 8 additions and 11 deletions

View file

@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event } from 'vs/base/common/event';
import { Event, Emitter } from 'vs/base/common/event';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { DisposableStore, dispose } from 'vs/base/common/lifecycle';
import { DisposableStore, IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IFilesConfiguration, ISortOrderConfiguration, SortOrder, LexicographicOptions } from 'vs/workbench/contrib/files/common/files';
import { ExplorerItem, ExplorerModel } from 'vs/workbench/contrib/files/common/explorerModel';
import { URI } from 'vs/base/common/uri';
@ -25,10 +25,8 @@ import { RunOnceScheduler } from 'vs/base/common/async';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IExpression, parse } from 'vs/base/common/glob';
import { mixin, deepClone, equals } from 'vs/base/common/objects';
import { IDisposable } from 'vs/base/common/lifecycle';
import { CachedParsedExpression } from 'vs/workbench/contrib/files/browser/views/explorerViewer';
import { Emitter } from 'vs/base/common/event';
import { relative } from 'path';
import { relative } from 'vs/base/common/path';
export const UNDO_REDO_SOURCE = new UndoRedoSource();
@ -138,7 +136,7 @@ export class ExplorerService implements IExplorerService {
this.revealExcludeMatcher = new RevealFilter(
contextService, configurationService);
this.disposables.add(this.revealExcludeMatcher);
this.disposables.add(this.revealExcludeMatcher.onDidChange(() => this.refresh()))
this.disposables.add(this.revealExcludeMatcher.onDidChange(() => this.refresh()));
}
get roots(): ExplorerItem[] {
@ -443,7 +441,7 @@ class RevealFilter implements IDisposable {
let shouldFire = false;
this.contextService.getWorkspace().folders.forEach(folder => {
const configuration = this.configurationService.getValue<IFilesConfiguration>({ resource: folder.uri });
const excludesConfig: IExpression = getRevealExcludes(configuration, true) || Object.create(null)
const excludesConfig: IExpression = getRevealExcludes(configuration, true) || Object.create(null);
if (!shouldFire) {
const cached = this.revealExpressionPerRoot.get(folder.uri.toString());
@ -469,13 +467,13 @@ class RevealFilter implements IDisposable {
const root = item.root;
let currentItem = item;
// If any parent up to the root matches pattern, do not reveal
while (currentItem != root) {
while (currentItem !== root) {
if (cached.parsed(relative(currentItem.root.resource.path, currentItem.resource.path), currentItem.name, name => !!(currentItem.parent && currentItem.parent.getChild(name)))) {
return false;
}
if (!currentItem.parent) {
return true;
};
}
currentItem = currentItem.parent;
}
return true;

View file

@ -570,8 +570,7 @@ function trimCategoryForGroup(category: string, groupId: string): string {
}
export function isExcludeSetting(setting: ISetting): boolean {
return setting.key in
['files.exclude', 'search.exclude', 'files.watcherExclude', 'explorer.autoRevealExclude'];
return ['files.exclude', 'search.exclude', 'files.watcherExclude', 'explorer.autoRevealExclude'].includes(setting.key);
}
function isObjectRenderableSchema({ type }: IJSONSchema): boolean {