@@ -87,7 +87,8 @@ import {
8787 runShellCommand , redirectHost , readGithubRepoFolder , FileCache ,
8888 genGithubHash , md5 , toArray , newMarkdownString , newFileTooltipString , FileTooltipInfo , escapeXml ,
8989 readGithubRepoTxtFile , downloadFile , notifyReloadWindow , formatPath , execInternalCommand ,
90- copyAndMakeObjectKeysToLowerCase
90+ copyAndMakeObjectKeysToLowerCase ,
91+ sortPaths
9192} from './utility' ;
9293import { concatSystemEnvPath , DeleteDir , exeSuffix , kill , osType , DeleteAllChildren } from './Platform' ;
9394import { KeilARMOption , KeilC51Option , KeilParser , KeilRteDependence } from './KeilXmlParser' ;
@@ -1164,7 +1165,13 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
11641165 const keyList = config . CustomDep_GetEnabledKeys ( ) ;
11651166
11661167 for ( const key of keyList ) {
1167- const depValues : string [ ] = ( < any > customDep ) [ key ] ;
1168+
1169+ let depValues : string [ ] = ( < any > customDep ) [ key ] ;
1170+
1171+ if ( key == 'incList' || key == 'libList' ) { // is path list ?
1172+ depValues = sortPaths ( depValues . map ( ( val ) => project . toRelativePath ( val ) ) , '/' ) ;
1173+ }
1174+
11681175 if ( Array . isArray ( depValues ) ) {
11691176 iList . push ( new ProjTreeItem ( TreeItemType . DEPENDENCE_GROUP_ARRAY_FIELD , {
11701177 value : config . GetDepKeyDesc ( key ) ,
@@ -1173,9 +1180,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
11731180 `- **Count:** \`${ depValues . length } \`` ] ) ,
11741181 obj : new ModifiableDepInfo ( 'None' , key ) ,
11751182 childKey : key ,
1176- child : depValues
1177- . map ( ( val ) => { return project . toRelativePath ( val ) ; } )
1178- . sort ( ( val_1 , val_2 ) => { return val_1 . length - val_2 . length ; } ) ,
1183+ child : depValues ,
11791184 projectIndex : element . val . projectIndex
11801185 } ) ) ;
11811186 }
@@ -5621,31 +5626,39 @@ export class ProjectExplorer implements CustomConfigurationProvider {
56215626 async showIncludeDir ( prjIndex : number ) {
56225627
56235628 const prj = this . dataProvider . GetProjectByIndex ( prjIndex ) ;
5624- let pickItems : vscode . QuickPickItem [ ] = [ ] ;
5629+ const pickItems : vscode . QuickPickItem [ ] = [ ] ;
56255630 const includesMap : Map < string , string > = new Map ( ) ;
56265631
5632+ let includes : string [ ] = [ ] ;
5633+
56275634 // add dependence include paths
56285635 prj . GetConfiguration ( ) . getAllDepGroup ( ) . forEach ( ( group ) => {
56295636 for ( const dep of group . depList ) {
56305637 for ( const incPath of dep . incList ) {
5631- includesMap . set ( prj . toRelativePath ( incPath ) , group . groupName ) ;
5638+ const repath = prj . toRelativePath ( incPath ) ;
5639+ includes . push ( repath ) ;
5640+ includesMap . set ( repath , group . groupName ) ;
56325641 }
56335642 }
56345643 } ) ;
56355644
56365645 // add source include paths
56375646 prj . getSourceIncludeList ( ) . forEach ( ( incPath ) => {
5638- includesMap . set ( prj . toRelativePath ( incPath ) , 'source' ) ;
5647+ const repath = prj . toRelativePath ( incPath ) ;
5648+ includes . push ( repath ) ;
5649+ includesMap . set ( repath , 'source' ) ;
56395650 } ) ;
56405651
5641- for ( const keyVal of includesMap ) {
5652+ includes = sortPaths ( includes , '/' ) ;
56425653
5643- const incPath = keyVal [ 0 ] ;
5644- const grpName = keyVal [ 1 ] ;
5654+ for ( const repath of includes ) {
5655+
5656+ const incPath = repath ;
5657+ const grpName = includesMap . get ( repath ) ;
56455658
56465659 let descpLi : string [ ] = [ ] ;
56475660
5648- if ( grpName != ProjectConfiguration . CUSTOM_GROUP_NAME ) {
5661+ if ( grpName && grpName != ProjectConfiguration . CUSTOM_GROUP_NAME ) {
56495662 descpLi . push ( grpName ) ;
56505663 }
56515664
@@ -5659,15 +5672,6 @@ export class ProjectExplorer implements CustomConfigurationProvider {
56595672 } ) ;
56605673 }
56615674
5662- // sort result
5663- pickItems = pickItems . sort ( ( i1 , i2 ) => {
5664- if ( i1 . description && i2 . description && i1 . description != i2 . description ) {
5665- return i1 . description . localeCompare ( i2 . description ) ;
5666- } else {
5667- return i1 . label . length - i2 . label . length ;
5668- }
5669- } ) ;
5670-
56715675 const item = await vscode . window . showQuickPick ( pickItems , {
56725676 placeHolder : `${ pickItems . length } results, click one copy to clipboard`
56735677 } ) ;
0 commit comments