mirror of
https://github.com/evosoftie/AILint.git
synced 2026-08-06 12:56:52 +01:00
Implement StatusBarUI for analysis results display
This commit is contained in:
parent
63bcbd6785
commit
4fc87af2db
1 changed files with 46 additions and 0 deletions
46
vscode-extension/src/ui/statusBar.ts
Normal file
46
vscode-extension/src/ui/statusBar.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
import * as vscode from 'vscode';
|
||||||
|
import { AnalysisResult } from '../analysis/analyzer';
|
||||||
|
|
||||||
|
export class StatusBarUI {
|
||||||
|
private statusBarItem: vscode.StatusBarItem;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.statusBarItem = vscode.window.createStatusBarItem(
|
||||||
|
vscode.StatusBarAlignment.Right,
|
||||||
|
100
|
||||||
|
);
|
||||||
|
this.statusBarItem.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public update(analysis: AnalysisResult | null) {
|
||||||
|
if (!analysis) {
|
||||||
|
this.statusBarItem.text = '$(check) AILint: Ready';
|
||||||
|
this.statusBarItem.tooltip = 'No AI influence detected';
|
||||||
|
this.statusBarItem.backgroundColor = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const percentage = (analysis.confidence * 100).toFixed(0);
|
||||||
|
|
||||||
|
if (analysis.confidence < 0.3) {
|
||||||
|
// Low likelihood
|
||||||
|
this.statusBarItem.text = `$(check) AI: ${percentage}%`;
|
||||||
|
this.statusBarItem.backgroundColor = undefined;
|
||||||
|
} else if (analysis.confidence < 0.7) {
|
||||||
|
// Medium likelihood
|
||||||
|
this.statusBarItem.text = `$(warning) AI: ${percentage}%`;
|
||||||
|
this.statusBarItem.backgroundColor = new vscode.ThemeColor(
|
||||||
|
'statusBarItem.warningBackground'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// High likelihood
|
||||||
|
this.statusBarItem.text = `$(alert) AI: ${percentage}%`;
|
||||||
|
this.statusBarItem.backgroundColor = new vscode.ThemeColor(
|
||||||
|
'statusBarItem.errorBackground'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.statusBarItem.tooltip = analysis.explanation;
|
||||||
|
this.statusBarItem.command = 'ailint.showDetails';
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue