@@ -4788,41 +4788,51 @@ export class ProjectExplorer implements CustomConfigurationProvider {
47884788 if ( ! extraArgs )
47894789 return ;
47904790
4791- const ccArgs = project . getExtraArgsForSource ( fspath , virtpath , extraArgs ) ?. join ( ' ' ) . trim ( ) || '' ;
4791+ const argsMap = project . getExtraArgsForSource ( fspath , virtpath , extraArgs ) ;
47924792 const absPattern = project . getExtraArgsAbsPatternForSource ( fspath , virtpath , extraArgs ) ;
4793- const isInherited = ccArgs && ! absPattern ;
4793+ const ccOptions = absPattern ? ( argsMap [ absPattern ] || '' ) : '' ;
4794+
4795+ // merge all inherited args
4796+ let inheritedArgs : string = '' ;
4797+ for ( const key in argsMap ) {
4798+ const val = argsMap [ key ] ?. trim ( ) ;
4799+ if ( key != absPattern && val ) {
4800+ inheritedArgs = `${ inheritedArgs } ${ val } ` ;
4801+ }
4802+ }
4803+ inheritedArgs = inheritedArgs . trim ( ) ;
47944804
47954805 const ui_cfg : SimpleUIConfig = {
4796- title : 'Extra Compiler Args ' ,
4806+ title : 'Extra Compiler Options ' ,
47974807 items : { } ,
47984808 } ;
47994809
4800- if ( isInherited ) { // 继承于其他匹配模式
4810+ if ( inheritedArgs ) { // 继承于其他匹配模式
48014811 ui_cfg . items [ 'inherit' ] = {
48024812 type : 'input' ,
48034813 attrs : { readonly : true } ,
4804- name : `Inherited Args (from other args pattern, check your '*.files.options.yml' file for details !)` ,
4814+ name : `Inherited Options (from other pattern, check your '*.files.options.yml' file for details !)` ,
48054815 data : < SimpleUIConfigData_input > {
4806- value : ccArgs ,
4807- default : ccArgs
4816+ value : inheritedArgs ,
4817+ default : inheritedArgs
48084818 }
48094819 } ;
48104820 }
48114821
48124822 ui_cfg . items [ 'args' ] = {
48134823 type : 'input' ,
48144824 attrs : { } ,
4815- name : 'Compiler Args ' ,
4825+ name : 'Compiler Options ' ,
48164826 data : < SimpleUIConfigData_input > {
48174827 placeHolder : `compiler options, like: '-O1', '-Os', '-flto' ...` ,
4818- value : isInherited ? '' : ccArgs ,
4819- default : isInherited ? '' : ccArgs ,
4828+ value : ccOptions ,
4829+ default : ccOptions ,
48204830 } ,
48214831 } ;
48224832
48234833 WebPanelManager . instance ( ) . showSimpleConfigUI ( ui_cfg , ( new_cfg ) => {
48244834
4825- const nArgs = ( < SimpleUIConfigData_input > new_cfg . items [ 'args' ] . data ) . value . trim ( ) ;
4835+ const nArgs = ( < SimpleUIConfigData_input > new_cfg . items [ 'args' ] . data ) . value . replace ( / \r \n | \n / g , ' ' ) . trim ( ) ;
48264836
48274837 let pattern : string ;
48284838
@@ -4884,35 +4894,45 @@ export class ProjectExplorer implements CustomConfigurationProvider {
48844894 if ( ! extraArgs )
48854895 return ;
48864896
4887- const ccArgs = project . getExtraArgsForFolder ( folderpath , isVirtpath , extraArgs ) ?. join ( ' ' ) . trim ( ) || '' ;
4897+ const argsMap = project . getExtraArgsForFolder ( folderpath , isVirtpath , extraArgs ) ;
48884898 const absPattern = project . getExtraArgsAbsPatternForFolder ( folderpath , isVirtpath , extraArgs ) ;
4889- const isInherited = ccArgs && ! absPattern ;
4899+ const ccOptions = absPattern ? ( argsMap [ absPattern ] || '' ) : '' ;
4900+
4901+ // merge all inherited args
4902+ let inheritedOptions : string = '' ;
4903+ for ( const key in argsMap ) {
4904+ const val = argsMap [ key ] ?. trim ( ) ;
4905+ if ( key != absPattern && val ) {
4906+ inheritedOptions = `${ inheritedOptions } ${ val } ` ;
4907+ }
4908+ }
4909+ inheritedOptions = inheritedOptions . trim ( ) ;
48904910
48914911 const ui_cfg : SimpleUIConfig = {
4892- title : 'Extra Compiler Args ' ,
4912+ title : 'Extra Compiler Options ' ,
48934913 items : { } ,
48944914 } ;
48954915
4896- if ( isInherited ) { // 继承于其他匹配模式
4916+ if ( inheritedOptions ) { // 继承于其他匹配模式
48974917 ui_cfg . items [ 'inherit' ] = {
48984918 type : 'input' ,
48994919 attrs : { readonly : true } ,
4900- name : `Inherited Args (from other args pattern, check your '*.files.options.yml' file for details !)` ,
4920+ name : `Inherited Options (from other args pattern, check your '*.files.options.yml' file for details !)` ,
49014921 data : < SimpleUIConfigData_input > {
4902- value : ccArgs ,
4903- default : ccArgs
4922+ value : inheritedOptions ,
4923+ default : inheritedOptions
49044924 }
49054925 } ;
49064926 }
49074927
49084928 ui_cfg . items [ 'args' ] = {
49094929 type : 'input' ,
49104930 attrs : { } ,
4911- name : 'Compiler Args ' ,
4931+ name : 'Compiler Options ' ,
49124932 data : < SimpleUIConfigData_input > {
49134933 placeHolder : `compiler options, like: '-O1', '-Os', '-flto' ...` ,
4914- value : isInherited ? '' : ccArgs ,
4915- default : isInherited ? '' : ccArgs ,
4934+ value : ccOptions ,
4935+ default : ccOptions ,
49164936 } ,
49174937 } ;
49184938
@@ -4930,7 +4950,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
49304950
49314951 WebPanelManager . instance ( ) . showSimpleConfigUI ( ui_cfg , ( new_cfg ) => {
49324952
4933- const nArgs = ( < SimpleUIConfigData_input > new_cfg . items [ 'args' ] . data ) . value . trim ( ) ;
4953+ const nArgs = ( < SimpleUIConfigData_input > new_cfg . items [ 'args' ] . data ) . value . replace ( / \r \n | \n / g , ' ' ) . trim ( ) ;
49344954 const isRecursive = ( < SimpleUIConfigData_boolean > new_cfg . items [ 'recursive' ] . data ) . value ;
49354955
49364956 let pattern : string ;
0 commit comments