Skip to content

Commit

Permalink
Merge pull request #13 from mohankumarelec/main
Browse files Browse the repository at this point in the history
Bump version to 1.96.1 and improve restart notifications for updates
  • Loading branch information
mohankumarelec authored Dec 19, 2024
2 parents 0623878 + bced0d6 commit 683f3fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "flexpilot-vscode-extension",
"displayName": "Flexpilot",
"description": "Open-Source, Native and a True GitHub Copilot Alternative for VS Code",
"version": "1.96.0",
"version": "1.96.1",
"icon": "assets/logo.png",
"license": "GPL-3.0-only",
"pricing": "Free",
Expand Down
46 changes: 17 additions & 29 deletions src/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ const isArgvJsonOutdated = async () => {
export const updateRuntimeArguments = async () => {
// Initialize the flag to require a restart
let requireRestart = false;
let restartMessage =
"Flexpilot: Please restart VS Code to apply the latest updates";

// Hide the chat setup if it is visible
try {
await vscode.commands.executeCommand("workbench.action.chat.hideSetup");
} catch (error) {
logger.warn(`Chat setup not found: ${String(error)}`);
}

// Check if the argv.json file is outdated
if (await isArgvJsonOutdated()) {
Expand All @@ -278,15 +287,18 @@ export const updateRuntimeArguments = async () => {
requireRestart = true;
}

// Check if GitHub Copilot is active
if (isGitHubCopilotActive()) {
logger.warn("GitHub Copilot is active, restart required");
restartMessage =
"Flexpilot: To ensure Flexpilot functions correctly, kindly disable `GitHub Copilot` and Restart";
}

// Notify the user about the required restart
if (requireRestart) {
// Show a notification to restart VS Code
vscode.window
.showInformationMessage(
"Flexpilot: Please restart VS Code to apply the latest updates",
"Restart",
"View Logs",
)
.showInformationMessage(restartMessage, "Restart", "View Logs")
.then((selection) => {
if (selection === "Restart") {
triggerVscodeRestart();
Expand All @@ -299,30 +311,6 @@ export const updateRuntimeArguments = async () => {
throw new Error("Flexpilot: VS Code restart required");
}

// Check if GitHub Copilot is active
if (isGitHubCopilotActive()) {
logger.warn("GitHub Copilot is active");
// Notify the user about GitHub Copilot compatibility
vscode.window
.showWarningMessage(
"To ensure Flexpilot functions correctly, kindly disable GitHub Copilot and reload the window",
"Reload Window",
"View Logs",
)
.then((selection) => {
if (selection === "Reload Window") {
vscode.commands.executeCommand("workbench.action.reloadWindow");
} else if (selection === "View Logs") {
logger.showOutputChannel();
}
});

// Throw an error to stop the execution
throw new Error(
"Flexpilot: GitHub Copilot is active and needs to be disabled",
);
}

// Log the successful activation
logger.info("Successfully updated runtime arguments");
};

0 comments on commit 683f3fa

Please sign in to comment.