mirror of
https://github.com/Gmaker689/ai-diff-preview.git
synced 2026-09-26 23:11:51 +08:00
fix: 状态栏Diff模式精简为2按钮 Accept/Reject 解决显示不全
This commit is contained in:
+13
-38
@@ -15,70 +15,46 @@ import { COMMANDS } from '../models/constants';
|
|||||||
export class StatusBarManager {
|
export class StatusBarManager {
|
||||||
/** ★ 常驻摘要按钮 */
|
/** ★ 常驻摘要按钮 */
|
||||||
private summaryItem: vscode.StatusBarItem;
|
private summaryItem: vscode.StatusBarItem;
|
||||||
/** Diff 模式 Accept 按钮 */
|
/** Diff 模式 Accept 按钮(接受当前文件所有变更) */
|
||||||
private acceptBtn: vscode.StatusBarItem;
|
private acceptBtn: vscode.StatusBarItem;
|
||||||
/** Diff 模式 Reject 按钮 */
|
/** Diff 模式 Reject 按钮(拒绝当前文件所有变更) */
|
||||||
private rejectBtn: vscode.StatusBarItem;
|
private rejectBtn: vscode.StatusBarItem;
|
||||||
/** Diff 模式 Accept All 按钮 */
|
|
||||||
private acceptAllBtn: vscode.StatusBarItem;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private changeSetManager: ChangeSetManager,
|
private changeSetManager: ChangeSetManager,
|
||||||
private diffViewer: DiffViewer
|
private diffViewer: DiffViewer
|
||||||
) {
|
) {
|
||||||
// ★ 常驻摘要 — 始终显示
|
// ★ 常驻摘要 — 始终显示
|
||||||
this.summaryItem = vscode.window.createStatusBarItem(
|
this.summaryItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 100);
|
||||||
vscode.StatusBarAlignment.Left,
|
|
||||||
100
|
|
||||||
);
|
|
||||||
this.summaryItem.command = COMMANDS.SHOW_DIFF_PANEL;
|
this.summaryItem.command = COMMANDS.SHOW_DIFF_PANEL;
|
||||||
this.summaryItem.text = '$(diff) AI Diff';
|
this.summaryItem.text = '$(diff) AI Diff';
|
||||||
this.summaryItem.tooltip = 'AI Diff — 点击查看变更列表';
|
this.summaryItem.tooltip = 'AI Diff — 点击查看变更列表';
|
||||||
this.summaryItem.show();
|
this.summaryItem.show();
|
||||||
|
|
||||||
// Accept 按钮
|
// Accept 按钮(接受当前文件所有变更)
|
||||||
this.acceptBtn = vscode.window.createStatusBarItem(
|
this.acceptBtn = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100);
|
||||||
vscode.StatusBarAlignment.Right,
|
this.acceptBtn.command = 'aiDiffPreview.acceptAllFromDiff';
|
||||||
100
|
|
||||||
);
|
|
||||||
this.acceptBtn.command = 'aiDiffPreview.acceptCurrentDiff';
|
|
||||||
|
|
||||||
// Reject 按钮
|
// Reject 按钮(拒绝当前文件所有变更)
|
||||||
this.rejectBtn = vscode.window.createStatusBarItem(
|
this.rejectBtn = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 99);
|
||||||
vscode.StatusBarAlignment.Right,
|
|
||||||
99
|
|
||||||
);
|
|
||||||
this.rejectBtn.command = 'aiDiffPreview.rejectCurrentDiff';
|
this.rejectBtn.command = 'aiDiffPreview.rejectCurrentDiff';
|
||||||
|
|
||||||
// Accept All 按钮
|
|
||||||
this.acceptAllBtn = vscode.window.createStatusBarItem(
|
|
||||||
vscode.StatusBarAlignment.Right,
|
|
||||||
98
|
|
||||||
);
|
|
||||||
this.acceptAllBtn.command = 'aiDiffPreview.acceptAllFromDiff';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enterDiffMode(session: DiffSession): void {
|
enterDiffMode(_session: DiffSession): void {
|
||||||
const label = session.editId ? '编辑' : '文件';
|
this.acceptBtn.text = '$(check) Accept';
|
||||||
this.acceptBtn.text = `$(check) Accept 本次${label}变更`;
|
|
||||||
this.acceptBtn.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground');
|
this.acceptBtn.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground');
|
||||||
this.acceptBtn.tooltip = `接受此${label}的变更并跳转到下一个`;
|
this.acceptBtn.tooltip = '接受此文件所有变更';
|
||||||
this.acceptBtn.show();
|
this.acceptBtn.show();
|
||||||
|
|
||||||
this.rejectBtn.text = `$(close) Reject 本次${label}变更`;
|
this.rejectBtn.text = '$(close) Reject';
|
||||||
this.rejectBtn.backgroundColor = new vscode.ThemeColor('statusBarItem.errorBackground');
|
this.rejectBtn.backgroundColor = new vscode.ThemeColor('statusBarItem.errorBackground');
|
||||||
this.rejectBtn.tooltip = `拒绝此${label}的变更并跳转到下一个`;
|
this.rejectBtn.tooltip = '拒绝此文件所有变更';
|
||||||
this.rejectBtn.show();
|
this.rejectBtn.show();
|
||||||
|
|
||||||
this.acceptAllBtn.text = '$(check-all) 接受此文件全部';
|
|
||||||
this.acceptAllBtn.tooltip = '接受此文件的所有编辑';
|
|
||||||
this.acceptAllBtn.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exitDiffMode(): void {
|
exitDiffMode(): void {
|
||||||
this.acceptBtn.hide();
|
this.acceptBtn.hide();
|
||||||
this.rejectBtn.hide();
|
this.rejectBtn.hide();
|
||||||
this.acceptAllBtn.hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ★ 常驻刷新 */
|
/** ★ 常驻刷新 */
|
||||||
@@ -122,6 +98,5 @@ export class StatusBarManager {
|
|||||||
this.summaryItem.dispose();
|
this.summaryItem.dispose();
|
||||||
this.acceptBtn.dispose();
|
this.acceptBtn.dispose();
|
||||||
this.rejectBtn.dispose();
|
this.rejectBtn.dispose();
|
||||||
this.acceptAllBtn.dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user