memento.ts ×13

Frontier kind: Code frontier

unlabeled · c_c68115abe381

34 tests · 23610 LOC · 123 files · introduces 0 tests · 37 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges37 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2776 ranges23610 lines · 123 files · Browse complete extent
All tests (intent)
34 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: 37 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/common/memento.ts 37 introduced LOC · 13 ranges

Open complete file

22
23 constructor(id: string, private storageService: IStorageService) {
24 > this.id = Memento.COMMON_PREFIX + id; memento.ts
25 > }
26
27 getMemento(scope: StorageScope, target: StorageTarget): Partial<T> {
28 > switch (scope) { memento.ts
29 > case StorageScope.WORKSPACE: {
30 > let workspaceMemento = Memento.workspaceMementos.get(this.id);
31 > if (!workspaceMemento) {
32 > workspaceMemento = new ScopedMemento(this.id, scope, target, this.storageService);
33 > Memento.workspaceMementos.set(this.id, workspaceMemento);
34 > }
35 >
36 > return workspaceMemento.getMemento();
37 > }
38 >
39 > case StorageScope.PROFILE: {
40 let profileMemento = Memento.profileMementos.get(this.id);
41 if (!profileMemento) {
46 return profileMemento.getMemento();
47 }
48 > memento.ts
49 > case StorageScope.APPLICATION: {
50 let applicationMemento = Memento.applicationMementos.get(this.id);
51 if (!applicationMemento) {
56 return applicationMemento.getMemento();
57 }
58 > memento.ts
59 > case StorageScope.APPLICATION_SHARED: {
60 let applicationSharedMemento = Memento.applicationSharedMementos.get(this.id);
61 if (!applicationSharedMemento) {
66 return applicationSharedMemento.getMemento();
67 }
68 > } memento.ts
69 > }
70
71 onDidChangeValue(scope: StorageScope, disposables: DisposableStore): Event<IStorageValueChangeEvent> {
101
102 static clear(scope: StorageScope): void {
103 > switch (scope) { memento.ts
104 > case StorageScope.WORKSPACE:
105 > Memento.workspaceMementos.clear();
106 > break;
107 > case StorageScope.PROFILE:
108 Memento.profileMementos.clear();
109 break;
110 > case StorageScope.APPLICATION: memento.ts
111 Memento.applicationMementos.clear();
112 break;
113 > case StorageScope.APPLICATION_SHARED: memento.ts
114 Memento.applicationSharedMementos.clear();
115 break;
116 > } memento.ts
117 > }
118 }
119
123
124 constructor(private id: string, private scope: StorageScope, private target: StorageTarget, private storageService: IStorageService) {
125 > this.mementoObj = this.doLoad(); memento.ts
126 > }
127
128 private doLoad(): Partial<T> {
129 > try { memento.ts
130 > return this.storageService.getObject(this.id, this.scope, {});
131 > } catch (error) {
132 // Seeing reports from users unable to open editors
133 // from memento parsing exceptions. Log the contents
138
139 return {};
140 > } memento.ts
141
142 getMemento(): Partial<T> {
143 > return this.mementoObj; memento.ts
144 > }
145
146 reload(): void {