userDataProfile.ts ×14

Frontier kind: Code frontier

unlabeled · c_c5e33232b083

51 tests · 12752 LOC · 55 files · introduces 0 tests · 46 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges46 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1955 ranges12752 lines · 55 files · Browse complete extent
All tests (intent)
51 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: 46 introduced LOC across 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/userDataProfile/common/userDataProfile.ts 46 introduced LOC · 14 ranges

Open complete file

310 const profileAssociaitions = this.getStoredProfileAssociations();
311 if (profileAssociaitions.workspaces) {
312 > for (const [workspacePath, profileId] of Object.entries(profileAssociaitions.workspaces)) { userDataProfile.ts
313 const workspace = URI.parse(workspacePath);
314 const profile = profiles.find(p => p.id === profileId);
319 }
320 }
322 if (profileAssociaitions.emptyWindows) {
323 > for (const [windowId, profileId] of Object.entries(profileAssociaitions.emptyWindows)) { userDataProfile.ts
324 const profile = profiles.find(p => p.id === profileId);
325 if (profile) {
327 }
328 }
330 } catch (error) {
331 this.logService.error(error);
629
630 private updateProfiles(added: IUserDataProfile[], removed: IUserDataProfile[], updated: IUserDataProfile[], donotTrigger: boolean = false): void {
631 > const allProfiles: Mutable<IUserDataProfile>[] = [...this.profiles, ...added]; userDataProfile.ts
632 >
633 > const transientProfiles = this.transientProfilesObject.profiles;
634 > this.transientProfilesObject.profiles = [];
635 >
636 > const profiles: IUserDataProfile[] = [];
637 >
638 > for (let profile of allProfiles) {
639 > // removed
640 > if (removed.some(p => profile.id === p.id)) {
641 for (const windowId of [...this.profilesObject.emptyWindows.keys()]) {
642 if (profile.id === this.profilesObject.emptyWindows.get(windowId)?.id) {
646 continue;
647 }
649 > if (!profile.isDefault) {
650 profile = updated.find(p => profile.id === p.id) ?? profile;
651 const transientProfile = transientProfiles.find(p => profile.id === p.id);
665 }
666 }
668 > if (profile.workspaces?.length === 0) {
669 profile.workspaces = undefined;
670 }
672 > profiles.push(profile);
673 > }
674 >
675 > this.updateStoredProfiles(profiles);
676 >
677 > if (!donotTrigger) {
678 > this.triggerProfilesChanges(added, removed, updated);
679 > }
680 > }
681
682 protected triggerProfilesChanges(added: IUserDataProfile[], removed: IUserDataProfile[], updated: IUserDataProfile[]) {
683 > this._onDidChangeProfiles.fire({ added, removed, updated, all: this.profiles }); userDataProfile.ts
684 > }
685
686 private updateEmptyWindowAssociation(windowId: string, newProfile: IUserDataProfile | undefined, transient: boolean): void {
708
709 private updateStoredProfiles(profiles: IUserDataProfile[]): void {
710 > const storedProfiles: StoredUserDataProfile[] = []; userDataProfile.ts
711 > const workspaces: IStringDictionary<string> = {};
712 > const emptyWindows: IStringDictionary<string> = {};
713 >
714 > for (const profile of profiles) {
715 > if (profile.isTransient) {
716 continue;
717 }
718 > if (!profile.isDefault) { userDataProfile.ts
719 storedProfiles.push({
720 location: profile.location,
724 });
725 }
726 > if (profile.workspaces) { userDataProfile.ts
727 for (const workspace of profile.workspaces) {
728 workspaces[workspace.toString()] = profile.id;
729 }
730 }
732 >
733 > for (const [windowId, profile] of this.profilesObject.emptyWindows.entries()) {
734 emptyWindows[windowId.toString()] = profile.id;
735 }
737 > this.saveStoredProfileAssociations({ workspaces, emptyWindows });
738 > this.saveStoredProfiles(storedProfiles);
739 > this._profilesObject = undefined;
740 > }
741
742 protected getStoredProfiles(): StoredUserDataProfile[] { return []; }