@@ -259,6 +259,15 @@ const isArgvJsonOutdated = async () => {
259
259
export const updateRuntimeArguments = async ( ) => {
260
260
// Initialize the flag to require a restart
261
261
let requireRestart = false ;
262
+ let restartMessage =
263
+ "Flexpilot: Please restart VS Code to apply the latest updates" ;
264
+
265
+ // Hide the chat setup if it is visible
266
+ try {
267
+ await vscode . commands . executeCommand ( "workbench.action.chat.hideSetup" ) ;
268
+ } catch ( error ) {
269
+ logger . warn ( `Chat setup not found: ${ String ( error ) } ` ) ;
270
+ }
262
271
263
272
// Check if the argv.json file is outdated
264
273
if ( await isArgvJsonOutdated ( ) ) {
@@ -278,15 +287,18 @@ export const updateRuntimeArguments = async () => {
278
287
requireRestart = true ;
279
288
}
280
289
290
+ // Check if GitHub Copilot is active
291
+ if ( isGitHubCopilotActive ( ) ) {
292
+ logger . warn ( "GitHub Copilot is active, restart required" ) ;
293
+ restartMessage =
294
+ "Flexpilot: To ensure Flexpilot functions correctly, kindly disable `GitHub Copilot` and Restart" ;
295
+ }
296
+
281
297
// Notify the user about the required restart
282
298
if ( requireRestart ) {
283
299
// Show a notification to restart VS Code
284
300
vscode . window
285
- . showInformationMessage (
286
- "Flexpilot: Please restart VS Code to apply the latest updates" ,
287
- "Restart" ,
288
- "View Logs" ,
289
- )
301
+ . showInformationMessage ( restartMessage , "Restart" , "View Logs" )
290
302
. then ( ( selection ) => {
291
303
if ( selection === "Restart" ) {
292
304
triggerVscodeRestart ( ) ;
@@ -299,30 +311,6 @@ export const updateRuntimeArguments = async () => {
299
311
throw new Error ( "Flexpilot: VS Code restart required" ) ;
300
312
}
301
313
302
- // Check if GitHub Copilot is active
303
- if ( isGitHubCopilotActive ( ) ) {
304
- logger . warn ( "GitHub Copilot is active" ) ;
305
- // Notify the user about GitHub Copilot compatibility
306
- vscode . window
307
- . showWarningMessage (
308
- "To ensure Flexpilot functions correctly, kindly disable GitHub Copilot and reload the window" ,
309
- "Reload Window" ,
310
- "View Logs" ,
311
- )
312
- . then ( ( selection ) => {
313
- if ( selection === "Reload Window" ) {
314
- vscode . commands . executeCommand ( "workbench.action.reloadWindow" ) ;
315
- } else if ( selection === "View Logs" ) {
316
- logger . showOutputChannel ( ) ;
317
- }
318
- } ) ;
319
-
320
- // Throw an error to stop the execution
321
- throw new Error (
322
- "Flexpilot: GitHub Copilot is active and needs to be disabled" ,
323
- ) ;
324
- }
325
-
326
314
// Log the successful activation
327
315
logger . info ( "Successfully updated runtime arguments" ) ;
328
316
} ;
0 commit comments