Skip to content

Commit 59f6098

Browse files
committed
fix performace issue for OnSetToolchainPath(). update toolchain descriptions
1 parent 7dad180 commit 59f6098

3 files changed

Lines changed: 29 additions & 34 deletions

File tree

src/OperationExplorer.ts

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export class OperationExplorer {
415415
const itemList: ProjectTemplatePickItem[] = [
416416
{
417417
label: '8051 Quick Start (SDCC)',
418-
detail: 'Universal 8051 example project with SDCC',
418+
detail: 'Generic 8051 example project with SDCC',
419419
templateName: 'mcs51_sdcc',
420420
type: 'C51'
421421
},
@@ -692,6 +692,14 @@ export class OperationExplorer {
692692
const toolchainManager = ToolchainManager.getInstance();
693693
const resManager = ResManager.GetInstance();
694694

695+
const makeToolchainDespTxt = (id: ToolchainName): string => {
696+
const dir = toolchainManager.getToolchainExecutableFolder(id);
697+
if (dir && dir.IsDir())
698+
return this.getStatusTxt(true) + ` Loc: ${dir.path}`;
699+
else
700+
return this.getStatusTxt(false) + ` Loc: ${dir?.path || ''}`
701+
};
702+
695703
const toolchainPickItems: ToolchainDespPickItem[] = [
696704
{
697705
type: 'None',
@@ -701,37 +709,32 @@ export class OperationExplorer {
701709
{
702710
label: 'Keil C51 (cx51) (ide path)',
703711
type: 'Keil_C51',
704-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('Keil_C51'))
705-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('Keil_C51')?.path}`,
712+
description: makeToolchainDespTxt('Keil_C51'),
706713
detail: view_str$operation$setKeil51Path
707714
},
708715
{
709716
label: 'IAR For STM8 (iccstm8) (ide path)',
710717
type: 'IAR_STM8',
711-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('IAR_STM8'))
712-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('IAR_STM8')?.path}`,
718+
description: makeToolchainDespTxt('IAR_STM8'),
713719
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'IAR For STM8')
714720
},
715721
{
716722
label: 'SDCC (sdcc)',
717723
type: 'SDCC',
718-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('SDCC'))
719-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('SDCC')?.path}`,
724+
description: makeToolchainDespTxt('SDCC'),
720725
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'SDCC')
721726
},
722727
{
723728
label: 'SDCC + Binutils For 8051 (sdcc + i51-elf-as)',
724729
type: 'GNU_SDCC_MCS51',
725-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('GNU_SDCC_MCS51'))
726-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('GNU_SDCC_MCS51')?.path}`,
730+
description: makeToolchainDespTxt('GNU_SDCC_MCS51'),
727731
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'SDCC + Binutils For 8051')
728732
},
729733
{
730734
label: 'COSMIC STM8 C Compiler (cxstm8)',
731735
type: 'COSMIC_STM8',
732-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('COSMIC_STM8'))
733-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('COSMIC_STM8')?.path}`,
734-
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'COSMIC_STM8'),
736+
description: makeToolchainDespTxt('COSMIC_STM8'),
737+
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'COSMIC STM8'),
735738
buttons: [
736739
{
737740
iconPath: vscode.Uri.file(resManager.GetIconByName('Login_16x.svg').path),
@@ -761,22 +764,19 @@ export class OperationExplorer {
761764
{
762765
label: 'ARMCC V5 (armcc) (standalone toolchain)',
763766
type: 'AC5',
764-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('AC5'))
765-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('AC5')?.path}`,
766-
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V5 Toolchain')
767+
description: makeToolchainDespTxt('AC5'),
768+
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V5')
767769
},
768770
{
769771
label: 'ARMCC V6 (armclang) (standalone toolchain)',
770772
type: 'AC6',
771-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('AC6'))
772-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('AC6')?.path}`,
773-
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V6 Toolchain')
773+
description: makeToolchainDespTxt('AC6'),
774+
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V6')
774775
},
775776
{
776777
label: 'IAR ARM C/C++ Compiler (iccarm) (standalone toolchain)',
777778
type: 'IAR_ARM',
778-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('IAR_ARM'))
779-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('IAR_ARM')?.path}`,
779+
description: makeToolchainDespTxt('IAR_ARM'),
780780
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'IAR ARM C/C++ Compiler')
781781
},
782782

@@ -789,8 +789,7 @@ export class OperationExplorer {
789789
{
790790
label: `GNU Arm Embedded Toolchain (${toolchainManager.getToolchainPrefix('GCC')}gcc)`,
791791
type: 'GCC',
792-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('GCC'))
793-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('GCC')?.path}`,
792+
description: makeToolchainDespTxt('GCC'),
794793
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `GNU Arm Embedded Toolchain`),
795794
buttons: [
796795
{
@@ -802,8 +801,7 @@ export class OperationExplorer {
802801
{
803802
label: `RISC-V GCC Toolchain (${toolchainManager.getToolchainPrefix('RISCV_GCC')}gcc)`,
804803
type: 'RISCV_GCC',
805-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('RISCV_GCC'))
806-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('RISCV_GCC')?.path}`,
804+
description: makeToolchainDespTxt('RISCV_GCC'),
807805
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `RISC-V GCC Toolchain`),
808806
buttons: [
809807
{
@@ -815,16 +813,14 @@ export class OperationExplorer {
815813
{
816814
label: 'MIPS MTI GCC Compiler',
817815
type: 'MTI_GCC',
818-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('MTI_GCC'))
819-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('MTI_GCC')?.path}`,
816+
description: makeToolchainDespTxt('MTI_GCC'),
820817
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'MTI_GCC'),
821818
},
822819
{
823-
label: `Universal GCC Toolchain (${toolchainManager.getToolchainPrefix('ANY_GCC')}gcc)`,
820+
label: `Generic GCC Toolchain (${toolchainManager.getToolchainPrefix('ANY_GCC')}gcc)`,
824821
type: 'ANY_GCC',
825-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('ANY_GCC'))
826-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('ANY_GCC')?.path}`,
827-
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `ANY GCC Toolchain`),
822+
description: makeToolchainDespTxt('ANY_GCC'),
823+
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `Generic GCC Toolchain`),
828824
buttons: [
829825
{
830826
iconPath: vscode.Uri.file(resManager.GetIconByName('EditTitleString_16x.svg').path),
@@ -842,8 +838,7 @@ export class OperationExplorer {
842838
{
843839
label: `LLVM Embedded Toolchain For Arm (clang)`,
844840
type: 'LLVM_ARM',
845-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('LLVM_ARM'))
846-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('LLVM_ARM')?.path}`,
841+
description: makeToolchainDespTxt('LLVM_ARM'),
847842
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `LLVM Embedded Toolchain For Arm`)
848843
}
849844
];

src/StringTable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ export const view_str$operation$empty_mips_prj = [
895895

896896
export const view_str$operation$empty_anygcc_prj = [
897897
'通用的 GCC 项目',
898-
'Universal GCC Project'
898+
'Generic GCC Project'
899899
][langIndex];
900900

901901
export const view_str$operation$open_serialport = [

src/ToolchainManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export class ToolchainManager {
319319
case 'RISCV_GCC':
320320
return 'GNU RISC-V Toolchain';
321321
case 'ANY_GCC':
322-
return 'GNU Toolchain';
322+
return 'Generic GNU Toolchain';
323323
case 'COSMIC_STM8':
324324
return 'COSMIC STM8 C Compiler';
325325
case 'MTI_GCC':

0 commit comments

Comments
 (0)