Skip to content

Commit

Permalink
Merge pull request #1137 from codota/avner/DEV2-2888-fix
Browse files Browse the repository at this point in the history
DEV2-2888 fix the status bar tooltip for logged in users
  • Loading branch information
avnerbarr authored Jun 11, 2023
2 parents f86d131 + 67bde1e commit fb321cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/statusBar/StatusBarData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export default class StatusBarData implements Disposable {

private _text?: string;

private _isLoggedIn?: boolean;

constructor(
private _statusBarItem: StatusBarItem,
private _context: ExtensionContext
Expand All @@ -41,6 +43,11 @@ export default class StatusBarData implements Disposable {
return this._serviceLevel;
}

public set isLoggedIn(isLoggedIn: boolean | undefined) {
this._isLoggedIn = isLoggedIn;
this.updateStatusBar();
}

public set icon(icon: string | undefined | null) {
this._icon = icon || undefined;
this.updateStatusBar();
Expand All @@ -66,6 +73,7 @@ export default class StatusBarData implements Disposable {
this._statusBarItem.text = `${FULL_BRAND_REPRESENTATION}${serviceLevel}${this.getIconText()}${issueText.trimEnd()}${limited}`;
if (
this._serviceLevel === "Free" &&
!this._isLoggedIn &&
isCapabilityEnabled(Capability.FORCE_REGISTRATION)
) {
this._statusBarItem.tooltip = "Sign in using your Tabnine account";
Expand Down
1 change: 1 addition & 0 deletions src/statusBar/statusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export async function onStartServiceLevel(): Promise<void> {

const state = await getState();
statusBarData.serviceLevel = state?.service_level;
statusBarData.isLoggedIn = state?.is_logged_in;
}

export function setDefaultStatus(): void {
Expand Down

0 comments on commit fb321cf

Please sign in to comment.