|
1 | 1 | import * as vscode from 'vscode'; |
2 | 2 | import * as path from 'path'; |
3 | 3 | import * as fs from 'fs'; |
4 | | -import { applyCvbToWorkspace, compressCvb, Cvb} from './cvbManager'; |
| 4 | +import { applyCvbToWorkspace, compressCvb, Cvb, generateCvb} from './cvbManager'; |
5 | 5 | import { analyzeCode } from './deepseekApi'; |
6 | 6 | import { getCurrentOperationController, resetCurrentOperationController, clearCurrentOperationController, doUploadCommand, saveAnalyzeCodeResult} from './extension'; |
7 | 7 | import { showInputMultiLineBox } from './UIComponents'; |
@@ -78,6 +78,20 @@ export function registerCvbContextMenu(context: vscode.ExtensionContext) { |
78 | 78 | }); |
79 | 79 | context.subscriptions.push(compressCvbCommand); |
80 | 80 |
|
| 81 | + const analyzeSingleFileCommand = vscode.commands.registerCommand('codeReDesign.analyzeSingleFile', async (uri: vscode.Uri) => { |
| 82 | + const filePath = uri.fsPath || ""; |
| 83 | + const cvbFile = await generateCvb([filePath], "分析单个文件:" + filePath); |
| 84 | + await analyzeThisCvb(cvbFile); |
| 85 | + }); |
| 86 | + context.subscriptions.push(analyzeSingleFileCommand); |
| 87 | + |
| 88 | + const uploadSingleFileCommand = vscode.commands.registerCommand('codeReDesign.uploadSingleFile', async (uri: vscode.Uri) => { |
| 89 | + const filePath = uri.fsPath || ""; |
| 90 | + const cvbFile = await generateCvb([filePath], "重构单个文件:" + filePath); |
| 91 | + await uploadThisCvb(cvbFile); |
| 92 | + }); |
| 93 | + context.subscriptions.push(uploadSingleFileCommand); |
| 94 | + |
81 | 95 | // 注册 TreeDataProvider |
82 | 96 | const cvbViewProvider = new CvbViewProvider(); |
83 | 97 | vscode.window.registerTreeDataProvider('codeReDesign.cvbView', cvbViewProvider); |
|
0 commit comments