Skip to content

Commit

Permalink
explorer: deemphasize items which should be excluded but are shown si…
Browse files Browse the repository at this point in the history
…nce they are open
  • Loading branch information
isidorn committed Mar 10, 2020
1 parent cb361ac commit 89e1209
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/vs/platform/theme/common/colorRegistry.ts
Expand Up @@ -365,6 +365,7 @@ export const listFilterWidgetNoMatchesOutline = registerColor('listFilterWidget.
export const listFilterMatchHighlight = registerColor('list.filterMatchBackground', { dark: editorFindMatchHighlight, light: editorFindMatchHighlight, hc: null }, nls.localize('listFilterMatchHighlight', 'Background color of the filtered match.'));
export const listFilterMatchHighlightBorder = registerColor('list.filterMatchBorder', { dark: editorFindMatchHighlightBorder, light: editorFindMatchHighlightBorder, hc: contrastBorder }, nls.localize('listFilterMatchHighlightBorder', 'Border color of the filtered match.'));
export const treeIndentGuidesStroke = registerColor('tree.indentGuidesStroke', { dark: '#585858', light: '#a9a9a9', hc: '#a9a9a9' }, nls.localize('treeIndentGuidesStroke', "Tree stroke color for the indentation guides."));
export const listDeemphasizedForeground = registerColor('list.deemphasizedForeground', { dark: '#8C8C8C', light: '#8E8E90', hc: '#A7A8A9' }, nls.localize('listDeemphasizedForeground', "List/Tree foreground color for items that are deemphasized. "));

/**
* Menu colors
Expand Down
Expand Up @@ -8,7 +8,7 @@ import { Event, Emitter } from 'vs/base/common/event';
import { localize } from 'vs/nls';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IDecorationsProvider, IDecorationData } from 'vs/workbench/services/decorations/browser/decorations';
import { listInvalidItemForeground } from 'vs/platform/theme/common/colorRegistry';
import { listInvalidItemForeground, listDeemphasizedForeground } from 'vs/platform/theme/common/colorRegistry';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { IExplorerService } from 'vs/workbench/contrib/files/common/files';
import { explorerRootErrorEmitter } from 'vs/workbench/contrib/files/browser/views/explorerViewer';
Expand All @@ -34,6 +34,11 @@ export function provideDecorations(fileStat: ExplorerItem): IDecorationData | un
letter: '?'
};
}
if (fileStat.isExcluded) {
return {
color: listDeemphasizedForeground,
};
}

return undefined;
}
Expand Down
Expand Up @@ -563,7 +563,9 @@ export class FilesFilter implements ITreeFilter<ExplorerItem, FuzzyScore> {
}

private isVisible(stat: ExplorerItem, parentVisibility: TreeVisibility): boolean {
stat.isExcluded = false;
if (parentVisibility === TreeVisibility.Hidden) {
stat.isExcluded = true;
return false;
}
if (this.explorerService.getEditableData(stat) || stat.isRoot) {
Expand All @@ -573,6 +575,7 @@ export class FilesFilter implements ITreeFilter<ExplorerItem, FuzzyScore> {
// Hide those that match Hidden Patterns
const cached = this.hiddenExpressionPerRoot.get(stat.root.resource.toString());
if (cached && cached.parsed(path.relative(stat.root.resource.path, stat.resource.path), stat.name, name => !!(stat.parent && stat.parent.getChild(name)))) {
stat.isExcluded = true;
const editors = this.editorService.visibleEditors;
const editor = editors.filter(e => e.resource && isEqualOrParent(e.resource, stat.resource)).pop();
if (editor) {
Expand Down
16 changes: 16 additions & 0 deletions src/vs/workbench/contrib/files/common/explorerModel.ts
Expand Up @@ -80,6 +80,7 @@ export class ExplorerItem {
protected _isDirectoryResolved: boolean;
private _isDisposed: boolean;
public isError = false;
private _isExcluded = false;

constructor(
public resource: URI,
Expand All @@ -95,6 +96,21 @@ export class ExplorerItem {
this._isDisposed = false;
}

get isExcluded(): boolean {
if (this._isExcluded) {
return true;
}
if (!this._parent) {
return false;
}

return this._parent.isExcluded;
}

set isExcluded(value: boolean) {
this._isExcluded = value;
}

get isDisposed(): boolean {
return this._isDisposed;
}
Expand Down

0 comments on commit 89e1209

Please sign in to comment.