@@ -110,6 +110,7 @@ import * as iarParser from './IarProjectParser';
110110import * as ArmCpuUtils from './ArmCpuUtils' ;
111111import { ShellFlasherIndexItem } from './WebInterface/WebInterface' ;
112112import { jsonc } from 'jsonc' ;
113+ import * as TxtTable from 'table'
113114
114115enum TreeItemType {
115116 SOLUTION ,
@@ -4453,6 +4454,76 @@ export class ProjectExplorer implements CustomConfigurationProvider {
44534454 this . exportLocked = false ;
44544455 }
44554456
4457+ async ShowProjectVariables ( item : ProjTreeItem ) {
4458+
4459+ const prj = this . dataProvider . GetProjectByIndex ( item . val . projectIndex ) ;
4460+ const prjVars = prj . getProjectVariables ( ) ;
4461+
4462+ let key_max_len = 0 ;
4463+ let val_max_len = 0 ;
4464+
4465+ let var_lines : string [ ] [ ] = [
4466+ [ 'Name' , 'Value' ]
4467+ ] ;
4468+
4469+ for ( const key in prjVars ) {
4470+
4471+ const val = prjVars [ key ] || '' ;
4472+
4473+ if ( key . length > key_max_len )
4474+ key_max_len = key . length ;
4475+
4476+ if ( val . length > val_max_len )
4477+ val_max_len = val . length ;
4478+
4479+ var_lines . push ( [ key , val ] ) ;
4480+ }
4481+
4482+ //
4483+ // make txt table
4484+ //
4485+
4486+ const tableCfg : TxtTable . TableUserConfig = {
4487+
4488+ header : {
4489+ alignment : 'center' ,
4490+ content : 'Project Variables'
4491+ } ,
4492+
4493+ columns : {
4494+ 0 : { width : key_max_len } ,
4495+ 1 : { width : val_max_len } ,
4496+ } ,
4497+
4498+ border : {
4499+ topBody : `─` ,
4500+ topJoin : `┬` ,
4501+ topLeft : `┌` ,
4502+ topRight : `┐` ,
4503+
4504+ bottomBody : `─` ,
4505+ bottomJoin : `┴` ,
4506+ bottomLeft : `└` ,
4507+ bottomRight : `┘` ,
4508+
4509+ bodyLeft : `│` ,
4510+ bodyRight : `│` ,
4511+ bodyJoin : `│` ,
4512+
4513+ joinBody : `─` ,
4514+ joinLeft : `├` ,
4515+ joinRight : `┤` ,
4516+ joinJoin : `┼`
4517+ }
4518+ } ;
4519+
4520+ const vpath = prj . toAbsolutePath ( 'project-variables' ) ;
4521+ VirtualDocument . instance ( ) . updateDocument ( vpath , TxtTable . table ( var_lines , tableCfg ) ) ;
4522+ vscode . window . showTextDocument (
4523+ vscode . Uri . parse ( VirtualDocument . instance ( ) . getUriByPath ( vpath ) ) ,
4524+ { preview : true } ) ;
4525+ }
4526+
44564527 async AddSrcDir ( item : ProjTreeItem ) {
44574528
44584529 const prj = this . dataProvider . GetProjectByIndex ( item . val . projectIndex ) ;
0 commit comments