MCPcopy
hub / github.com/continuedev/continue / cascadeInit

Method cascadeInit

core/config/ConfigHandler.ts:83–136  ·  view source on GitHub ↗
(reason: string)

Source from the content-addressed store, hash-verified

81 }
82
83 private async cascadeInit(reason: string) {
84 const signal = this.cascadeAbortController.signal;
85 this.workspaceDirs = null; // forces workspace dirs reload
86
87 this.globalLocalProfileManager = new ProfileLifecycleManager(
88 new LocalProfileLoader(this.ide, this.llmLogger),
89 this.ide,
90 );
91
92 try {
93 const { profiles, errors } = await this.loadProfiles();
94
95 // Figure out selected profile
96 const workspaceId = await this.getWorkspaceId();
97 const selectedProfiles =
98 this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
99 const currentSelection = selectedProfiles[workspaceId];
100
101 const fallback = profiles.length > 0 ? profiles[0] : null;
102
103 let selectedProfile: ProfileLifecycleManager | null;
104 if (currentSelection) {
105 const match = profiles.find(
106 (profile) => profile.profileDescription.id === currentSelection,
107 );
108 selectedProfile = match ?? fallback;
109 } else {
110 selectedProfile = fallback;
111 }
112
113 if (signal.aborted) {
114 return;
115 }
116
117 if (selectedProfile) {
118 this.globalContext.update("lastSelectedProfileForWorkspace", {
119 ...selectedProfiles,
120 [workspaceId]: selectedProfile.profileDescription.id,
121 });
122 }
123
124 this.profiles = profiles;
125 this.currentProfile = selectedProfile;
126
127 await this.reloadConfig(reason, errors);
128 } catch (e) {
129 if (signal.aborted) {
130 return;
131 } else {
132 this.initter.emit("init"); // Error case counts as init
133 throw e;
134 }
135 }
136 }
137
138 private async loadProfiles(): Promise<{
139 profiles: ProfileLifecycleManager[];

Callers 3

constructorMethod · 0.95
refreshAllMethod · 0.95
updateIdeSettingsMethod · 0.95

Calls 6

loadProfilesMethod · 0.95
getWorkspaceIdMethod · 0.95
reloadConfigMethod · 0.95
getMethod · 0.65
updateMethod · 0.65
emitMethod · 0.65

Tested by

no test coverage detected