File tree Expand file tree Collapse file tree 3 files changed +25
-9
lines changed
Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 5353 },
5454 {
5555 "command" : " codeReDesign.analyzeCode" ,
56- "title" : " CodeReDesign: Analyze Code" ,
56+ "title" : " Analyze Code" ,
5757 "category" : " CodeReDesign" ,
5858 "icon" : " ${bug}"
5959 },
6060 {
6161 "command" : " codeReDesign.applyThisCvb" ,
62- "title" : " Apply this CVB to Workspace" ,
62+ "title" : " sidebar Apply this CVB to Workspace" ,
6363 "when" : " false" ,
6464 "category" : " CodeReDesign" ,
6565 "icon" : " ${save}"
6666 },
6767 {
6868 "command" : " codeReDesign.uploadThisCvb" ,
69- "title" : " Upload this CVB and Call API" ,
69+ "title" : " sidebar Upload this CVB and Call API" ,
7070 "when" : " false" ,
7171 "category" : " CodeReDesign" ,
7272 "icon" : " ${cloud-upload}"
7373 },
7474 {
7575 "command" : " codeReDesign.analyzeThisCvb" ,
76- "title" : " Analyze this CVB" ,
76+ "title" : " sidebar Analyze this CVB" ,
7777 "when" : " false" ,
7878 "category" : " CodeReDesign" ,
7979 "icon" : " ${bug}"
Original file line number Diff line number Diff line change @@ -177,6 +177,13 @@ export function activate(context: vscode.ExtensionContext) {
177177 vscode . window . showErrorMessage ( 'No CVB files found in the tmp directory.' ) ;
178178 return ;
179179 }
180+
181+ // 按照创建时间逆序排序
182+ cvbFiles . sort ( ( a , b ) => {
183+ const statsA = fs . statSync ( path . join ( tmpDir , a ) ) ;
184+ const statsB = fs . statSync ( path . join ( tmpDir , b ) ) ;
185+ return statsB . birthtime . getTime ( ) - statsA . birthtime . getTime ( ) ; // 逆序排序
186+ } ) ;
180187
181188 const selectedCvbFile = await vscode . window . showQuickPick ( cvbFiles , {
182189 placeHolder : 'Select a CVB file to upload' ,
@@ -266,6 +273,13 @@ export function activate(context: vscode.ExtensionContext) {
266273 return ;
267274 }
268275
276+ // 按照创建时间逆序排序
277+ cvbFiles . sort ( ( a , b ) => {
278+ const statsA = fs . statSync ( path . join ( tmpDir , a ) ) ;
279+ const statsB = fs . statSync ( path . join ( tmpDir , b ) ) ;
280+ return statsB . birthtime . getTime ( ) - statsA . birthtime . getTime ( ) ; // 逆序排序
281+ } ) ;
282+
269283 // 让用户选择要分析的 CVB 文件
270284 const selectedCvbFile = await vscode . window . showQuickPick ( cvbFiles , {
271285 placeHolder : 'Select a CVB file to analyze' ,
Original file line number Diff line number Diff line change @@ -109,11 +109,13 @@ class CvbViewProvider implements vscode.TreeDataProvider<vscode.TreeItem> {
109109 } ) ;
110110 }
111111
112- // 修改后的排序逻辑
113- files . sort ( ( a , b ) => {
114- const labelA = a . label ? a . label . toString ( ) : '' ;
115- const labelB = b . label ? b . label . toString ( ) : '' ;
116- return labelA . localeCompare ( labelB , undefined , { sensitivity : 'base' } ) ;
112+ // 按创建时间逆序排序
113+ files . sort ( ( a , b ) => {
114+ const filePathA = a . resourceUri ?. fsPath || "" ;
115+ const filePathB = b . resourceUri ?. fsPath || "" ;
116+ const statsA = fs . statSync ( filePathA ) ;
117+ const statsB = fs . statSync ( filePathB ) ;
118+ return statsB . birthtime . getTime ( ) - statsA . birthtime . getTime ( ) ; // 逆序排序
117119 } ) ;
118120
119121 return files ;
You can’t perform that action at this time.
0 commit comments