enablement.ts ×9

Frontier kind: Code frontier

unlabeled · c_e45fba7c2c75

7 tests · 42518 LOC · 197 files · introduces 0 tests · 19 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges19 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3900 ranges42518 lines · 197 files · Browse complete extent
All tests (intent)
7 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: 19 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/enablement.ts 19 introduced LOC · 9 ranges

Open complete file

32 type EnablementMap = ReadonlyMap<string, boolean>;
33
34 > function mapToStorage(value: EnablementMap): string { enablement.ts
35 > return JSON.stringify([...value]);
36 > }
37
38 function mapFromStorage(value: string): EnablementMap {
99
100 setEnabled(key: string, state: ContributionEnablementState, tx?: ITransaction): void {
101 > this.setEnabledWithWorkspaceKey(key, key, state, tx); enablement.ts
102 > }
103
104 setEnabledWithWorkspaceKey(profileKey: string, workspaceKey: string | undefined, state: ContributionEnablementState, tx?: ITransaction): void {
105 > switch (state) { enablement.ts
106 > case ContributionEnablementState.EnabledProfile: {
107 // Enabled-profile is the default: remove key from profile state,
108 // and also remove any workspace override.
113 break;
114 }
115 > case ContributionEnablementState.DisabledProfile: { enablement.ts
116 // Store disabled in profile, remove workspace override.
117 this._setInMap(this._profileState, profileKey, false, tx);
121 break;
122 }
123 > case ContributionEnablementState.EnabledWorkspace: { enablement.ts
124 // Workspace override: always store explicitly.
125 if (workspaceKey === undefined) {
129 break;
130 }
131 > case ContributionEnablementState.DisabledWorkspace: { enablement.ts
132 // Workspace override: always store explicitly.
133 if (workspaceKey === undefined) {
137 break;
138 }
139 > } enablement.ts
140 >
141 > }
142
143 remove(key: string): void {
147
148 private _setInMap(memento: ObservableMemento<EnablementMap>, key: string, value: boolean, tx?: ITransaction): void {
149 > const current = memento.get(); enablement.ts
150 > if (current.get(key) === value) {
151 return;
152 }
153 > const next = new Map(current); enablement.ts
154 > next.set(key, value);
155 > memento.set(next, tx);
156 > }
157
158 private _deleteFromMap(memento: ObservableMemento<EnablementMap>, key: string, tx?: ITransaction): void {