( ide: IDE, ideSettings: IdeSettings, ideInfo: IdeInfo, uniqueId: string, llmLogger: ILLMLogger, overrideConfigJson: SerializedContinueConfig | undefined, )
| 789 | } |
| 790 | |
| 791 | async function loadContinueConfigFromJson( |
| 792 | ide: IDE, |
| 793 | ideSettings: IdeSettings, |
| 794 | ideInfo: IdeInfo, |
| 795 | uniqueId: string, |
| 796 | llmLogger: ILLMLogger, |
| 797 | overrideConfigJson: SerializedContinueConfig | undefined, |
| 798 | ): Promise<ConfigResult<ContinueConfig>> { |
| 799 | const workspaceConfigs = await getWorkspaceRcConfigs(ide); |
| 800 | // Serialized config |
| 801 | let { |
| 802 | config: serialized, |
| 803 | errors, |
| 804 | configLoadInterrupted, |
| 805 | } = loadSerializedConfig( |
| 806 | workspaceConfigs, |
| 807 | ideSettings, |
| 808 | ideInfo.ideType, |
| 809 | overrideConfigJson, |
| 810 | ide, |
| 811 | ); |
| 812 | |
| 813 | if (!serialized || configLoadInterrupted) { |
| 814 | return { errors, config: undefined, configLoadInterrupted: true }; |
| 815 | } |
| 816 | |
| 817 | // Apply shared config |
| 818 | // TODO: override several of these values with user/org shared config |
| 819 | const sharedConfig = new GlobalContext().getSharedConfig(); |
| 820 | const withShared = modifyAnyConfigWithSharedConfig(serialized, sharedConfig); |
| 821 | |
| 822 | // Convert serialized to intermediate config |
| 823 | let intermediate = await serializedToIntermediateConfig(withShared, ide); |
| 824 | |
| 825 | // Apply config.ts to modify intermediate config |
| 826 | const configJsContents = await buildConfigTsandReadConfigJs( |
| 827 | ide, |
| 828 | ideInfo.ideType, |
| 829 | ); |
| 830 | if (configJsContents) { |
| 831 | try { |
| 832 | // Try config.ts first |
| 833 | const configJsPath = getConfigJsPath(); |
| 834 | let module: any; |
| 835 | |
| 836 | try { |
| 837 | module = await import(configJsPath); |
| 838 | } catch (e) { |
| 839 | console.log(e); |
| 840 | console.log( |
| 841 | "Could not load config.ts as absolute path, retrying as file url ...", |
| 842 | ); |
| 843 | try { |
| 844 | module = await import(localPathToUri(configJsPath)); |
| 845 | } catch (e) { |
| 846 | throw new Error("Could not load config.ts as file url either", { |
| 847 | cause: e, |
| 848 | }); |
no test coverage detected