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

Function loadSerializedConfig

core/config/load.ts:112–167  ·  view source on GitHub ↗
(
  workspaceConfigs: ContinueRcJson[],
  ideSettings: IdeSettings,
  ideType: IdeType,
  overrideConfigJson: SerializedContinueConfig | undefined,
  ide: IDE,
)

Source from the content-addressed store, hash-verified

110};
111
112function loadSerializedConfig(
113 workspaceConfigs: ContinueRcJson[],
114 ideSettings: IdeSettings,
115 ideType: IdeType,
116 overrideConfigJson: SerializedContinueConfig | undefined,
117 ide: IDE,
118): ConfigResult<SerializedContinueConfig> {
119 let config: SerializedContinueConfig = overrideConfigJson!;
120 if (!config) {
121 try {
122 config = resolveSerializedConfig(getConfigJsonPath());
123 } catch (e) {
124 throw new Error(`Failed to parse config.json: ${e}`);
125 }
126 }
127
128 const errors = validateConfig(config);
129
130 if (errors?.some((error) => error.fatal)) {
131 return {
132 errors,
133 config: undefined,
134 configLoadInterrupted: true,
135 };
136 }
137
138 if (config.allowAnonymousTelemetry === undefined) {
139 config.allowAnonymousTelemetry = true;
140 }
141
142 if (ideSettings.remoteConfigServerUrl) {
143 try {
144 const remoteConfigJson = resolveSerializedConfig(
145 getConfigJsonPathForRemote(ideSettings.remoteConfigServerUrl),
146 );
147 config = mergeJson(config, remoteConfigJson, "merge", configMergeKeys);
148 } catch (e) {
149 console.warn("Error loading remote config: ", e);
150 }
151 }
152
153 for (const workspaceConfig of workspaceConfigs) {
154 config = mergeJson(
155 config,
156 workspaceConfig,
157 workspaceConfig.mergeBehavior,
158 configMergeKeys,
159 );
160 }
161
162 if (os.platform() === "linux" && !isSupportedLanceDbCpuTargetForLinux(ide)) {
163 config.disableIndexing = true;
164 }
165
166 return { config, errors, configLoadInterrupted: false };
167}
168
169async function serializedToIntermediateConfig(

Callers 1

Calls 7

getConfigJsonPathFunction · 0.90
resolveSerializedConfigFunction · 0.85
validateConfigFunction · 0.85
mergeJsonFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected