MCPcopy Index your code
hub / github.com/continuedev/continue / handleConfigSelect

Function handleConfigSelect

extensions/cli/src/ui/hooks/useConfigSelector.ts:34–107  ·  view source on GitHub ↗
(config: ConfigOption)

Source from the content-addressed store, hash-verified

32 const { closeCurrentScreen } = useNavigation();
33
34 const handleConfigSelect = async (config: ConfigOption) => {
35 closeCurrentScreen();
36
37 if (config.type === "create") {
38 // Open the web browser to create new assistant
39 const url = new URL("https://continue.dev/new");
40 url.searchParams.set("type", "assistant");
41
42 try {
43 let command: string;
44 if (process.platform === "darwin") {
45 command = `open "${url}"`;
46 } else if (process.platform === "win32") {
47 command = `start "${url}"`;
48 } else {
49 command = `xdg-open "${url}"`;
50 }
51
52 exec(command, (error) => {
53 if (error) {
54 console.error("Failed to open browser:", error);
55 }
56 });
57
58 onMessage({
59 role: "system",
60 content: `Opening ${url} in your browser to create a new assistant...`,
61 messageType: "system" as const,
62 });
63 } catch {
64 onMessage({
65 role: "system",
66 content: `Please visit ${url} to create a new assistant`,
67 messageType: "system" as const,
68 });
69 }
70 return;
71 }
72
73 try {
74 // Show loading message
75 onMessage({
76 role: "system",
77 content: `Switching to configuration: ${config.name}...`,
78 messageType: "system" as const,
79 });
80
81 let targetConfigPath: string | undefined;
82
83 if (config.type === "local") {
84 targetConfigPath = CONFIG_PATH;
85 } else if (config.type === "assistant" && config.slug) {
86 targetConfigPath = config.slug;
87 }
88
89 await services.config.updateConfigPath(targetConfigPath);
90
91 handleClear();

Callers

nothing calls this directly

Calls 4

onMessageFunction · 0.85
errorMethod · 0.80
updateConfigPathMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected