Skip to content

Commit 92c6214

Browse files
committed
refactor: remove unused code paths and dead exports
1 parent 2bdbb4a commit 92c6214

17 files changed

Lines changed: 13 additions & 357 deletions

File tree

src/featureLoader.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ function failureResult(error: Error): FeatureActivationResult {
99
return { success: false, error };
1010
}
1111

12-
function successResult(disabled = false): FeatureActivationResult {
13-
return { success: true, disabled };
14-
}
15-
1612
export class FeatureLoader {
1713
private modules = new Map<string, FeatureModule>();
1814
private activatedModules = new Set<string>();
@@ -34,12 +30,6 @@ export class FeatureLoader {
3430
}
3531
}
3632

37-
async activateAll(
38-
context: vscode.ExtensionContext
39-
): Promise<Map<string, FeatureActivationResult>> {
40-
return this.activateStartupModules(context);
41-
}
42-
4333
async activateStartupModules(
4434
context: vscode.ExtensionContext
4535
): Promise<Map<string, FeatureActivationResult>> {
@@ -89,22 +79,6 @@ export class FeatureLoader {
8979
Logger.info("所有功能模块已停用");
9080
}
9181

92-
getActivationResult(name: string): FeatureActivationResult | undefined {
93-
return this.activationResults.get(name);
94-
}
95-
96-
isActivated(name: string): boolean {
97-
return this.activatedModules.has(name);
98-
}
99-
100-
getRegisteredModules(): string[] {
101-
return Array.from(this.modules.keys());
102-
}
103-
104-
getActivatedModules(): string[] {
105-
return Array.from(this.activatedModules);
106-
}
107-
10882
private async activateModulesParallel(
10983
modules: FeatureModule[],
11084
context: vscode.ExtensionContext
@@ -275,5 +249,3 @@ export class FeatureLoader {
275249
}
276250

277251
export const featureLoader = new FeatureLoader();
278-
279-
export { successResult as createSuccessResult, failureResult as createFailureResult };

src/features/aiCommit/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ export class GitService {
511511
cp.exec(
512512
command,
513513
{ cwd, maxBuffer: 1024 * 1024 * 50 }, // Increased buffer to 50MB for potential bulk diffs
514-
(err, stdout, stderr) => {
514+
(err, stdout) => {
515515
if (err) {
516516
reject(err);
517517
return;

src/features/aiCommit/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function activate(context: vscode.ExtensionContext) {
3434
const promptProvider = new (class
3535
implements vscode.TextDocumentContentProvider
3636
{
37-
provideTextDocumentContent(uri: vscode.Uri): string {
37+
provideTextDocumentContent(): string {
3838
if (!lastContext) return "No Prompt generated yet.";
3939

4040
const { diff, projectMeta } = lastContext;
@@ -124,7 +124,7 @@ export function activate(context: vscode.ExtensionContext) {
124124
vscode.commands.registerCommand("fusi-tools.previewSmartDiff", async () => {
125125
try {
126126
// 1. 显示加载中
127-
provider.showLoading("正在分析暂存文件与预处理...");
127+
provider.showLoading();
128128

129129
// 简短延迟让 UI 刷新
130130
await new Promise((r) => setTimeout(r, 100));
@@ -181,7 +181,7 @@ export function activate(context: vscode.ExtensionContext) {
181181
vscode.commands.registerCommand("fusi-tools.generateDirect", async () => {
182182
try {
183183
// 1. 显示加载
184-
provider.showLoading("正在直接生成...");
184+
provider.showLoading();
185185

186186
// 2. 获取 diff (不做 UI 预览,直接获取字符串)
187187
const analysis = await gitService.analyzeChanges();

src/features/aiCommit/treeProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class AiCommitViewProvider
169169
* 实际上现在结构变了,Loading 怎么显示?
170170
* 可以把 Loading 显示在 suggestions 下面,或者清空 suggestions
171171
*/
172-
showLoading(message: string = "正在分析暂存文件..."): void {
172+
showLoading(): void {
173173
this.commitOptions = [];
174174
this.changes = [];
175175
this.commitGroup.description = `(0)`;

src/features/gitWorktree/worktreeService.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { exec } from 'child_process';
22
import { promisify } from 'util';
3-
import * as vscode from 'vscode';
43

54
const execAsync = promisify(exec);
65

src/features/projectFavorites/favoritesProvider.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as vscode from "vscode";
22
import * as path from "path";
3-
import * as fs from "fs";
43
import {
54
FavoritesManager,
65
FavoriteCategory,

src/features/resourceManager/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export class ResourceCommands {
167167
const cmd = `(echo -n 'file://${escapedPath}' | xclip -selection clipboard -t text/uri-list 2>/dev/null) || (echo -n 'file://${escapedPath}' | wl-copy 2>/dev/null)`;
168168

169169
await new Promise<void>((resolve, reject) => {
170-
cp.exec(cmd, (error, stdout, stderr) => {
170+
cp.exec(cmd, (error) => {
171171
// 只要其中一个成功就算成功(通过 || 实现)
172172
// 检查是否真的失败:两个命令都失败才报错
173173
if (error && error.code !== 0) {

src/features/resourceManager/treeGenerator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as vscode from "vscode";
21
import * as fs from "fs";
32
import * as path from "path";
43

src/features/smartTranslate/index.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ import { TranslatorService, TranslationResult } from "./translator";
44
import { StatusBarManager } from "./ui/statusBar";
55
import { NameGenerator } from "./nameGenerator";
66
import { NamingPanel } from "./ui/namingPanel";
7-
import { SelectionDebugger } from "./utils/selectionDebugger";
87

98
let translatorService: TranslatorService | undefined;
109
let statusBarManager: StatusBarManager | undefined;
1110
let nameGenerator: NameGenerator | undefined;
1211
let namingPanel: NamingPanel | undefined;
1312
let lastTranslationResult: TranslationResult | null = null;
14-
let selectionDebugger: SelectionDebugger | undefined;
1513

1614
// 防抖相关变量
1715
let selectionDebounceTimer: NodeJS.Timeout | undefined;
@@ -46,7 +44,7 @@ export function activate(context: vscode.ExtensionContext) {
4644
// 检查配置是否启用
4745
const config = vscode.workspace.getConfiguration("fusi-tools.smartTranslate");
4846
if (config.get<boolean>("enabled", true)) {
49-
startFeature(context);
47+
startFeature();
5048
}
5149

5250
// 监听配置变化
@@ -57,7 +55,7 @@ export function activate(context: vscode.ExtensionContext) {
5755
.getConfiguration("fusi-tools.smartTranslate")
5856
.get<boolean>("enabled", true);
5957
if (newEnabled) {
60-
startFeature(context);
58+
startFeature();
6159
} else {
6260
stopFeature();
6361
}
@@ -86,7 +84,7 @@ async function toggleFeature() {
8684
}
8785
}
8886

89-
function startFeature(context: vscode.ExtensionContext) {
87+
function startFeature() {
9088
if (isEnabled) {
9189
return;
9290
}
@@ -95,8 +93,7 @@ function startFeature(context: vscode.ExtensionContext) {
9593
translatorService = new TranslatorService();
9694
statusBarManager = new StatusBarManager();
9795
nameGenerator = new NameGenerator();
98-
namingPanel = new NamingPanel(context);
99-
selectionDebugger = SelectionDebugger.getInstance();
96+
namingPanel = new NamingPanel();
10097

10198
// 监听文本选择变化
10299
const selectionChangeListener = vscode.window.onDidChangeTextEditorSelection(

src/features/smartTranslate/ui/namingPanel.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import * as vscode from "vscode";
22
import { NamingOption } from "../nameGenerator";
33

44
export class NamingPanel {
5-
private context: vscode.ExtensionContext;
6-
7-
constructor(context: vscode.ExtensionContext) {
8-
this.context = context;
9-
}
5+
constructor() {}
106

117
async show(namingOptions: NamingOption[]): Promise<void> {
128
if (!namingOptions || namingOptions.length === 0) {

0 commit comments

Comments
 (0)