@@ -23,7 +23,6 @@ import {
23
23
StarlarkDebuggerConfiguration ,
24
24
ComponentConfiguration ,
25
25
} from './configuration' ;
26
- import { Info } from '../proto/build/stack/bezel/v1beta1/Info' ;
27
26
import { BzlLanguageClient } from './lsp' ;
28
27
import { Runnable , Status } from './status' ;
29
28
import { Buildifier } from '../buildifier/buildifier' ;
@@ -397,6 +396,7 @@ class SubscriptionItem
397
396
398
397
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
399
398
const items : vscode . TreeItem [ ] = [ ] ;
399
+ items . push ( new DocumentationLinkItem ( 'subscription' ) )
400
400
401
401
if ( this . component . status === Status . DISABLED ) {
402
402
items . push ( new DisabledItem ( 'Subscription token not available.' ) ) ;
@@ -461,6 +461,7 @@ class SubscriptionItem
461
461
console . log ( 'license get error' , e ) ;
462
462
}
463
463
464
+
464
465
return items ;
465
466
}
466
467
}
@@ -488,7 +489,9 @@ class StarlarkLanguageServerItem
488
489
}
489
490
490
491
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
491
- return [ ] ;
492
+ return [
493
+ new DocumentationLinkItem ( 'starlark-language-server' ) ,
494
+ ] ;
492
495
}
493
496
}
494
497
@@ -501,7 +504,9 @@ class BuildifierItem
501
504
}
502
505
503
506
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
504
- return [ ] ;
507
+ return [
508
+ new DocumentationLinkItem ( 'buildifier' ) ,
509
+ ] ;
505
510
}
506
511
}
507
512
@@ -515,6 +520,7 @@ class BuildozerItem
515
520
516
521
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
517
522
const items : vscode . TreeItem [ ] = [ ] ;
523
+ items . push ( new DocumentationLinkItem ( 'buildozer' ) )
518
524
items . push ( this . createRunWizardItem ( ) ) ;
519
525
return items ;
520
526
}
@@ -546,6 +552,7 @@ class RemoteCacheItem
546
552
547
553
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
548
554
const items : vscode . TreeItem [ ] = [ ] ;
555
+ items . push ( new DocumentationLinkItem ( 'remote-cache' ) )
549
556
550
557
if ( ! this . remoteCache . terminal ) {
551
558
items . push ( this . createLaunchItem ( ) ) ;
@@ -585,13 +592,14 @@ class BzlServerItem
585
592
extends RunnableComponentItem < BzlConfiguration >
586
593
implements vscode . Disposable , Expandable {
587
594
constructor ( private bzl : Bzl , onDidChangeTreeData : ( item : vscode . TreeItem ) => void ) {
588
- super ( 'Bzl ' , 'UI' , bzl , onDidChangeTreeData ) ;
595
+ super ( 'Bezel ' , 'UI' , bzl , onDidChangeTreeData ) ;
589
596
this . collapsibleState = vscode . TreeItemCollapsibleState . Collapsed ;
590
597
bzl . onDidAttachTerminal ( ( ) => onDidChangeTreeData ( this ) , this , this . disposables ) ;
591
598
}
592
599
593
600
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
594
601
const items : vscode . TreeItem [ ] = [ ] ;
602
+ items . push ( new DocumentationLinkItem ( 'ui' ) )
595
603
596
604
if ( this . bzl . status === Status . DISABLED ) {
597
605
items . push ( new DisabledItem ( 'The Stack.Build subscription is not enabled.' ) ) ;
@@ -614,6 +622,7 @@ class BzlServerItem
614
622
items . push ( new BzlFrontendLinkItem ( cfg , 'Flag' , 'Browser' , `${ ws . id } /flags` ) ) ;
615
623
}
616
624
625
+
617
626
return items ;
618
627
}
619
628
@@ -653,6 +662,19 @@ class BzlMetadataItem extends vscode.TreeItem implements Expandable {
653
662
}
654
663
}
655
664
665
+ export class DocumentationLinkItem extends vscode . TreeItem {
666
+ constructor ( rel : string , label = 'Docs' ) {
667
+ super ( label ) ;
668
+ this . description = '/' + rel ;
669
+ this . iconPath = Container . media ( MediaIconName . StackBuild ) ;
670
+ this . command = {
671
+ title : 'Documentation Link' ,
672
+ command : BuiltInCommands . Open ,
673
+ arguments : [ vscode . Uri . parse ( `https://docs.stack.build/docs/vscode/${ rel } ` ) ] ,
674
+ } ;
675
+ }
676
+ }
677
+
656
678
export class BzlFrontendLinkItem extends vscode . TreeItem {
657
679
constructor ( cfg : BzlConfiguration , label : string , description : string , rel : string ) {
658
680
super ( label ) ;
@@ -680,6 +702,7 @@ class BuildEventServiceItem
680
702
681
703
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
682
704
const items : vscode . TreeItem [ ] = [ ] ;
705
+ items . push ( new DocumentationLinkItem ( 'build-events' ) )
683
706
684
707
if ( this . bes . status === Status . DISABLED ) {
685
708
items . push ( new DisabledItem ( 'Depends on the Bzl Service' ) ) ;
@@ -719,6 +742,7 @@ class StarlarkDebuggerItem
719
742
720
743
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
721
744
const items : vscode . TreeItem [ ] = [ ] ;
745
+ items . push ( new DocumentationLinkItem ( 'debugger' ) )
722
746
723
747
if ( this . debug . status === Status . DISABLED ) {
724
748
items . push ( new DisabledItem ( 'The Starlark Debugger is not enabled.' ) ) ;
@@ -759,8 +783,10 @@ class CodeSearchItem
759
783
760
784
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
761
785
const items : vscode . TreeItem [ ] = [ ] ;
786
+ items . push ( new DocumentationLinkItem ( 'codesearch' ) )
762
787
763
788
items . push ( this . createUsageItem ( ) ) ;
789
+
764
790
return items ;
765
791
}
766
792
@@ -779,6 +805,7 @@ class BazelServerItem
779
805
780
806
async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
781
807
const items : vscode . TreeItem [ ] = [ ] ;
808
+ items . push ( new DocumentationLinkItem ( 'bazel' ) )
782
809
783
810
if ( this . bazel . status === Status . DISABLED ) {
784
811
items . push ( new DisabledItem ( 'Depends on the Bzl Service' ) ) ;
@@ -1022,35 +1049,6 @@ function isRevealable(item: any): item is Revealable {
1022
1049
return 'getParent' in item ;
1023
1050
}
1024
1051
1025
- function infoContextValue ( key : string | undefined ) : string {
1026
- switch ( key ) {
1027
- case 'bazel-bin' :
1028
- case 'bazel-genfiles' :
1029
- case 'bazel-testlogs' :
1030
- case 'execution_root' :
1031
- case 'install_base' :
1032
- case 'java-home' :
1033
- case 'output_base' :
1034
- case 'output_path' :
1035
- case 'repository_cache' :
1036
- case 'workspace' :
1037
- return 'folder' ;
1038
- case 'server_log' :
1039
- case 'command_log' :
1040
- return 'file' ;
1041
- default :
1042
- return '' ;
1043
- }
1044
- }
1045
-
1046
- function infoMap ( infoList : Info [ ] ) : Map < string , Info > {
1047
- const m = new Map < string , Info > ( ) ;
1048
- for ( const info of infoList ) {
1049
- m . set ( info . key ! , info ) ;
1050
- }
1051
- return m ;
1052
- }
1053
-
1054
1052
function getThemeIconNameForPropertyType ( type : string ) : string {
1055
1053
switch ( type ) {
1056
1054
case 'string' :
@@ -1075,89 +1073,3 @@ function formatValue(v: any, def?: any): string {
1075
1073
}
1076
1074
return String ( v ) ;
1077
1075
}
1078
-
1079
- // private handleConfigurationChange(cfg: BezelConfiguration) {
1080
- // this.cfg = cfg;
1081
-
1082
- // this.starlarkLanguageServerItem.handleConfigurationChange(cfg);
1083
- // this.remoteCacheItem.handleConfigurationChange(cfg);
1084
- // }
1085
-
1086
- // private async handleBzlLanguageClientChange(lspClient: BzlLanguageClient) {
1087
- // this.lspClient = lspClient;
1088
- // this.starlarkLanguageServerItem.handleBzlLanguageClientChange(lspClient);
1089
- // if (!lspClient) {
1090
- // return;
1091
- // }
1092
- // }
1093
-
1094
- // private handleBzlServerClientChange(apiClient: BzlAPIClient) {
1095
- // this.apiClient = apiClient;
1096
- // if (!apiClient) {
1097
- // return;
1098
- // }
1099
-
1100
- // this.bzlServerItem.handleBzlServerClientChange(apiClient);
1101
-
1102
- // this.tryLoadBazelInfo(apiClient, 0);
1103
- // }
1104
-
1105
- // class BazelInfosItem extends vscode.TreeItem implements Expandable {
1106
- // constructor(public infos: Info[]) {
1107
- // super('Info');
1108
- // this.contextValue = 'info';
1109
- // this.iconPath = new vscode.ThemeIcon('info');
1110
- // this.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
1111
- // }
1112
-
1113
- // async getChildren(): Promise<vscode.TreeItem[] | undefined> {
1114
- // const infos = this.infos.map(i => new InfoItem(i));
1115
- // infos.sort((a, b): number => b.contextValue!.localeCompare(a.contextValue!) || 0);
1116
- // return infos;
1117
- // }
1118
- // }
1119
-
1120
- // class InfoItem extends vscode.TreeItem {
1121
- // constructor(public info: Info) {
1122
- // super(info.key!);
1123
- // this.contextValue = infoContextValue(info.key);
1124
- // this.description = this.contextValue ? true : info.value;
1125
- // this.resourceUri = this.contextValue ? vscode.Uri.file(info.value!) : undefined;
1126
- // this.tooltip = info.description;
1127
- // this.iconPath = new vscode.ThemeIcon('info');
1128
- // this.command = {
1129
- // title: info.description!,
1130
- // command: CommandName.CopyToClipboard,
1131
- // arguments: [info.value],
1132
- // };
1133
-
1134
- // if (this.contextValue === 'folder') {
1135
- // this.iconPath = new vscode.ThemeIcon('folder-active');
1136
- // } else if (this.contextValue === 'file') {
1137
- // this.iconPath = vscode.ThemeIcon.File;
1138
- // this.command = {
1139
- // title: info.description!,
1140
- // command: CommandName.OpenFile,
1141
- // arguments: [this],
1142
- // };
1143
- // }
1144
- // }
1145
- // }
1146
-
1147
- // class DefaultWorkspaceItem extends vscode.TreeItem implements Expandable {
1148
-
1149
- // constructor(
1150
- // private readonly cfg: BzlConfiguration,
1151
- // public readonly info: BazelInfo,
1152
- // ) {
1153
- // super('Default Workspace');
1154
- // this.contextValue = 'default';
1155
- // this.iconPath = Container.media(MediaIconName.Workspace);
1156
- // this.collapsibleState = vscode.TreeItemCollapsibleState.None;
1157
- // if (info.workspaceName) {
1158
- // this.description = '@' + info.workspaceName;
1159
- // } else {
1160
- // this.description = '@';
1161
- // }
1162
- // }
1163
- // }
0 commit comments