Skip to content

Commit

Permalink
feat: disable github sign in (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
l1shen authored Dec 4, 2024
1 parent 2da5086 commit fa5e61e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 124 deletions.
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,6 @@
"view": "workbench.panel.chat.view.copilot",
"contents": "$(loading~spin) Please wait while Flexpilot is getting activated",
"when": "!flexpilot:isError && !flexpilot:isLoaded"
},
{
"view": "workbench.panel.chat.view.copilot",
"contents": "Sign in with GitHub to use Flexpilot, your AI pair programmer.\n[Sign In](command:flexpilot.github.signin)",
"when": "!flexpilot:isError && flexpilot:isLoaded && !flexpilot:isLoggedIn"
}
],
"commands": [
Expand Down Expand Up @@ -373,4 +368,4 @@
"engines": {
"vscode": "1.95.x"
}
}
}
93 changes: 0 additions & 93 deletions src/commands/github-sign-in.ts

This file was deleted.

9 changes: 3 additions & 6 deletions src/inline-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getEol } from "./utilities";
class InlineChatParticipant {
private static instance: InlineChatParticipant | null = null;
private readonly chatParticipant: vscode.ChatParticipant;
private readonly githubSession: vscode.AuthenticationSession;
// private readonly githubSession: vscode.AuthenticationSession;

/**
* Private constructor to prevent direct instantiation.
Expand All @@ -28,14 +28,11 @@ class InlineChatParticipant {
);

// Get the GitHub session
this.githubSession = storage.session.get();
// this.githubSession = storage.session.get();

// Set up requester information
this.chatParticipant.requester = {
name: this.githubSession.account.label,
icon: vscode.Uri.parse(
`https://avatars.githubusercontent.com/u/${this.githubSession.account.id}`,
),
name: "anonymous",
};

// Set chat participant icon
Expand Down
2 changes: 0 additions & 2 deletions src/lazy-load.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { CommitMessageCommand } from "./commands/commit-message";
import { ConfigureModelCommand } from "./commands/configure-model";
import { GithubSignInCommand } from "./commands/github-sign-in";
import { StatusIconMenuCommand } from "./commands/status-icon-menu";
import { events } from "./events";
import { logger } from "./logger";
Expand Down Expand Up @@ -31,7 +30,6 @@ export const activate = async () => {
// Register the commands
StatusIconMenuCommand.register();
CommitMessageCommand.register();
GithubSignInCommand.register();
ConfigureModelCommand.register();

// Handle the session change
Expand Down
16 changes: 7 additions & 9 deletions src/panel-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import { VariablesManager } from "./variables";
class PanelChatParticipant {
private static instance: PanelChatParticipant | null = null;
private readonly chatParticipant: vscode.ChatParticipant;
private readonly githubSession: vscode.AuthenticationSession;
// private readonly githubSession: vscode.AuthenticationSession;

/**
* Private constructor to prevent direct instantiation.
* Initializes the chat participant with necessary providers and configurations.
*/
private constructor() {
// Get the GitHub session
this.githubSession = storage.session.get();
// this.githubSession = storage.session.get();

// Create the chat participant
this.chatParticipant = vscode.chat.createChatParticipant(
Expand Down Expand Up @@ -63,10 +63,10 @@ class PanelChatParticipant {

// Set up requester information
this.chatParticipant.requester = {
name: this.githubSession.account.label,
icon: vscode.Uri.parse(
`https://avatars.githubusercontent.com/u/${this.githubSession.account.id}`,
),
name: "anonymous",
// icon: vscode.Uri.parse(
// `https://avatars.githubusercontent.com/u/${this.githubSession.account.id}`,
// ),
};

// Set up help text variables prefix
Expand Down Expand Up @@ -219,9 +219,7 @@ class PanelChatParticipant {
return {
icon: new vscode.ThemeIcon("flexpilot-default"),
title: "Ask Flexpilot",
message: PanelChatPrompt.getWelcomeMessage(
this.githubSession.account.label,
),
message: PanelChatPrompt.getWelcomeMessage("anonymous"),
};
}

Expand Down
10 changes: 2 additions & 8 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ export class SessionManager extends vscode.Disposable {
// Register the session manager
extensionContext.subscriptions.push(this);

// Handle the session change
this.disposables.push(
vscode.authentication.onDidChangeSessions(() =>
this.handleSessionChange(),
),
);

// Initialize the session manager
logger.info("Session manager initialized");
}
Expand All @@ -47,7 +40,8 @@ export class SessionManager extends vscode.Disposable {
public static async register() {
if (!SessionManager.instance) {
SessionManager.instance = new SessionManager();
SessionManager.instance.handleSessionChange();
SessionManager.instance.registerSessionFeatures();
// SessionManager.instance.handleSessionChange();
logger.debug("New SessionManager instance created");
}
}
Expand Down

0 comments on commit fa5e61e

Please sign in to comment.