@@ -8,23 +8,22 @@ import { getCurrentOperationController, resetCurrentOperationController, clearC
88export function registerCvbContextMenu ( context : vscode . ExtensionContext ) {
99
1010 // 注册右键菜单命令
11- const applyCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.applyThisCvb' , ( uri : vscode . Uri ) => {
11+ const applyCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.applyThisCvb' , ( cvb : CvbFile ) => {
1212 // 获取文件路径
13- const filePath = uri . fsPath ;
14-
13+ const filePath = cvb . resourceUri ?. fsPath || "" ;
1514 // 调用处理函数
1615 applyThisCvb ( filePath ) ;
1716 } ) ;
1817
1918 // 注册上传 CVB 命令
20- const uploadCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.uploadThisCvb' , async ( uri : vscode . Uri ) => {
21- const filePath = uri . fsPath ;
19+ const uploadCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.uploadThisCvb' , async ( cvb : CvbFile ) => {
20+ const filePath = cvb . resourceUri ?. fsPath || "" ;
2221 await uploadThisCvb ( filePath ) ;
2322 } ) ;
2423
2524 // 注册分析 CVB 命令
26- const analyzeCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.analyzeThisCvb' , async ( uri : vscode . Uri ) => {
27- const filePath = uri . fsPath ;
25+ const analyzeCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.analyzeThisCvb' , async ( cvb : CvbFile ) => {
26+ const filePath = cvb . resourceUri ?. fsPath || "" ;
2827 await analyzeThisCvb ( filePath ) ;
2928 } ) ;
3029
@@ -105,6 +104,11 @@ class CvbViewProvider implements vscode.TreeDataProvider<CvbFile> {
105104 } ) ;
106105 }
107106
107+ // 新增排序逻辑
108+ cvbFiles . sort ( ( a , b ) =>
109+ a . label . localeCompare ( b . label , undefined , { sensitivity : 'base' } )
110+ ) ;
111+
108112 return cvbFiles ;
109113 }
110114 }
@@ -127,6 +131,8 @@ class CvbFile extends vscode.TreeItem {
127131 // 设置图标(可选)
128132 this . iconPath = vscode . ThemeIcon . File ;
129133
134+ this . resourceUri = uri ;
135+
130136 // 添加上下文菜单
131137 this . contextValue = 'cvbFile' ;
132138 }
0 commit comments