@@ -23,7 +23,6 @@ import {
2323 StarlarkDebuggerConfiguration ,
2424 ComponentConfiguration ,
2525} from './configuration' ;
26- import { Info } from '../proto/build/stack/bezel/v1beta1/Info' ;
2726import { BzlLanguageClient } from './lsp' ;
2827import { Runnable , Status } from './status' ;
2928import { Buildifier } from '../buildifier/buildifier' ;
@@ -397,6 +396,7 @@ class SubscriptionItem
397396
398397 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
399398 const items : vscode . TreeItem [ ] = [ ] ;
399+ items . push ( new DocumentationLinkItem ( 'subscription' ) )
400400
401401 if ( this . component . status === Status . DISABLED ) {
402402 items . push ( new DisabledItem ( 'Subscription token not available.' ) ) ;
@@ -461,6 +461,7 @@ class SubscriptionItem
461461 console . log ( 'license get error' , e ) ;
462462 }
463463
464+
464465 return items ;
465466 }
466467}
@@ -488,7 +489,9 @@ class StarlarkLanguageServerItem
488489 }
489490
490491 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
491- return [ ] ;
492+ return [
493+ new DocumentationLinkItem ( 'starlark-language-server' ) ,
494+ ] ;
492495 }
493496}
494497
@@ -501,7 +504,9 @@ class BuildifierItem
501504 }
502505
503506 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
504- return [ ] ;
507+ return [
508+ new DocumentationLinkItem ( 'buildifier' ) ,
509+ ] ;
505510 }
506511}
507512
@@ -515,6 +520,7 @@ class BuildozerItem
515520
516521 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
517522 const items : vscode . TreeItem [ ] = [ ] ;
523+ items . push ( new DocumentationLinkItem ( 'buildozer' ) )
518524 items . push ( this . createRunWizardItem ( ) ) ;
519525 return items ;
520526 }
@@ -546,6 +552,7 @@ class RemoteCacheItem
546552
547553 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
548554 const items : vscode . TreeItem [ ] = [ ] ;
555+ items . push ( new DocumentationLinkItem ( 'remote-cache' ) )
549556
550557 if ( ! this . remoteCache . terminal ) {
551558 items . push ( this . createLaunchItem ( ) ) ;
@@ -585,13 +592,14 @@ class BzlServerItem
585592 extends RunnableComponentItem < BzlConfiguration >
586593 implements vscode . Disposable , Expandable {
587594 constructor ( private bzl : Bzl , onDidChangeTreeData : ( item : vscode . TreeItem ) => void ) {
588- super ( 'Bzl ' , 'UI' , bzl , onDidChangeTreeData ) ;
595+ super ( 'Bezel ' , 'UI' , bzl , onDidChangeTreeData ) ;
589596 this . collapsibleState = vscode . TreeItemCollapsibleState . Collapsed ;
590597 bzl . onDidAttachTerminal ( ( ) => onDidChangeTreeData ( this ) , this , this . disposables ) ;
591598 }
592599
593600 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
594601 const items : vscode . TreeItem [ ] = [ ] ;
602+ items . push ( new DocumentationLinkItem ( 'ui' ) )
595603
596604 if ( this . bzl . status === Status . DISABLED ) {
597605 items . push ( new DisabledItem ( 'The Stack.Build subscription is not enabled.' ) ) ;
@@ -614,6 +622,7 @@ class BzlServerItem
614622 items . push ( new BzlFrontendLinkItem ( cfg , 'Flag' , 'Browser' , `${ ws . id } /flags` ) ) ;
615623 }
616624
625+
617626 return items ;
618627 }
619628
@@ -653,6 +662,19 @@ class BzlMetadataItem extends vscode.TreeItem implements Expandable {
653662 }
654663}
655664
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+
656678export class BzlFrontendLinkItem extends vscode . TreeItem {
657679 constructor ( cfg : BzlConfiguration , label : string , description : string , rel : string ) {
658680 super ( label ) ;
@@ -680,6 +702,7 @@ class BuildEventServiceItem
680702
681703 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
682704 const items : vscode . TreeItem [ ] = [ ] ;
705+ items . push ( new DocumentationLinkItem ( 'build-events' ) )
683706
684707 if ( this . bes . status === Status . DISABLED ) {
685708 items . push ( new DisabledItem ( 'Depends on the Bzl Service' ) ) ;
@@ -719,6 +742,7 @@ class StarlarkDebuggerItem
719742
720743 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
721744 const items : vscode . TreeItem [ ] = [ ] ;
745+ items . push ( new DocumentationLinkItem ( 'debugger' ) )
722746
723747 if ( this . debug . status === Status . DISABLED ) {
724748 items . push ( new DisabledItem ( 'The Starlark Debugger is not enabled.' ) ) ;
@@ -759,8 +783,10 @@ class CodeSearchItem
759783
760784 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
761785 const items : vscode . TreeItem [ ] = [ ] ;
786+ items . push ( new DocumentationLinkItem ( 'codesearch' ) )
762787
763788 items . push ( this . createUsageItem ( ) ) ;
789+
764790 return items ;
765791 }
766792
@@ -779,6 +805,7 @@ class BazelServerItem
779805
780806 async getChildrenInternal ( ) : Promise < vscode . TreeItem [ ] > {
781807 const items : vscode . TreeItem [ ] = [ ] ;
808+ items . push ( new DocumentationLinkItem ( 'bazel' ) )
782809
783810 if ( this . bazel . status === Status . DISABLED ) {
784811 items . push ( new DisabledItem ( 'Depends on the Bzl Service' ) ) ;
@@ -1022,35 +1049,6 @@ function isRevealable(item: any): item is Revealable {
10221049 return 'getParent' in item ;
10231050}
10241051
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-
10541052function getThemeIconNameForPropertyType ( type : string ) : string {
10551053 switch ( type ) {
10561054 case 'string' :
@@ -1075,89 +1073,3 @@ function formatValue(v: any, def?: any): string {
10751073 }
10761074 return String ( v ) ;
10771075}
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