assignmentContextFilter.ts ×9

Frontier kind: Code frontier

unlabeled · c_b10221c330c9

5 tests · 12793 LOC · 51 files · introduces 0 tests · 39 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges39 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1877 ranges12793 lines · 51 files · Browse complete extent
All tests (intent)
5 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 39 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/services/assignment/common/assignmentContextFilter.ts 39 introduced LOC · 9 ranges

Open complete file

72 */
73 filter(assignmentContext: string): string {
74 > const assignments = assignmentContext.split(';'); assignmentContextFilter.ts
75 >
76 > // Fresh exclusions produced by the currently registered filters, keyed by filter id.
77 > const freshFilteredOut = new Map<string, Set<string>>();
78 >
79 > const filteredAssignments = assignments.filter(assignment => {
80 > let excluded = false;
81 > for (const filter of this._filters) {
82 if (filter.exclude(assignment)) {
83 let set = freshFilteredOut.get(filter.id);
90 }
91 }
92 > if (excluded) { assignmentContextFilter.ts
93 return false;
94 }
96 > // Honor ids cached by filters that have not been registered yet, so they remain
97 > // excluded until the owning filter takes over.
98 > for (const [filterId, ids] of this._cachedFilteredOutIds) {
99 if (!this._registeredFilterIds.has(filterId) && ids.has(assignment)) {
100 return false;
101 }
102 }
104 > return true;
105 > });
106 >
107 > // Persist the reconciled cache: registered filters contribute exactly what they
108 > // currently exclude (dropping ids that are no longer filtered out), while entries owned
109 > // by not-yet-registered filters are preserved.
110 > const next = new Map<string, Set<string>>();
111 > for (const [filterId, ids] of this._cachedFilteredOutIds) {
112 if (!this._registeredFilterIds.has(filterId)) {
113 next.set(filterId, ids);
114 }
115 }
116 > for (const [filterId, ids] of freshFilteredOut) { assignmentContextFilter.ts
117 next.set(filterId, ids);
118 }
119 > this._storeFilteredOutIds(next); assignmentContextFilter.ts
120 >
121 > return filteredAssignments.join(';');
122 > }
123
124 private _loadFilteredOutIds(): Map<string, Set<string>> {
149
150 private _storeFilteredOutIds(next: Map<string, Set<string>>): void {
151 > // Drop empty entries so an id disappears from storage once nothing is filtered out for it. assignmentContextFilter.ts
152 > const normalized = new Map<string, Set<string>>();
153 > for (const [filterId, ids] of next) {
154 > if (ids.size > 0) {
155 > normalized.set(filterId, ids);
156 > }
157 > }
158 >
159 > if (areCachesEqual(normalized, this._cachedFilteredOutIds)) {
160 return;
161 }
172 this.storageService.store(AssignmentContextFilter.STORAGE_KEY, JSON.stringify(serializable), StorageScope.APPLICATION, StorageTarget.MACHINE);
173 }
175 }
176
177 > function areCachesEqual(a: Map<string, Set<string>>, b: Map<string, Set<string>>): boolean { assignmentContextFilter.ts
178 > if (a.size !== b.size) {
179 return false;
180 }