Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version to 1.96.1 and improve restart notifications for updates #13

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
};