File tree Expand file tree Collapse file tree 5 files changed +39
-8
lines changed Expand file tree Collapse file tree 5 files changed +39
-8
lines changed Original file line number Diff line number Diff line change 193193 {
194194 "command" : " vscode-objectscript.explorer.hideGenerated" ,
195195 "when" : " view == ObjectScriptExplorer && viewItem =~ /^serverNode.*:generated:/"
196+ },
197+ {
198+ "command" : " vscode-objectscript.explorer.showSystem" ,
199+ "when" : " view == ObjectScriptExplorer && viewItem =~ /^serverNode((?!:(%SYS|system):).)*$/"
200+ },
201+ {
202+ "command" : " vscode-objectscript.explorer.hideSystem" ,
203+ "when" : " view == ObjectScriptExplorer && viewItem =~ /^serverNode.*:system:/"
196204 }
197205 ],
198206 "editor/context" : [
402410 "title" : " Hide Generated" ,
403411 "category" : " ObjectScript"
404412 },
413+ {
414+ "command" : " vscode-objectscript.explorer.showSystem" ,
415+ "title" : " Show System" ,
416+ "category" : " ObjectScript"
417+ },
418+ {
419+ "command" : " vscode-objectscript.explorer.hideSystem" ,
420+ "title" : " Hide System" ,
421+ "category" : " ObjectScript"
422+ },
405423 {
406424 "command" : " vscode-objectscript.explorer.otherNamespaceClose" ,
407425 "title" : " Close Namespace" ,
Original file line number Diff line number Diff line change 11import * as vscode from "vscode" ;
2- import { config , workspaceState } from "../../extension" ;
32import { currentWorkspaceFolder } from "../../utils" ;
3+ import { AtelierAPI } from "../../api" ;
44
55export interface NodeOptions {
66 extraNode ?: boolean ;
77 generated ?: boolean ;
8+ system ?: boolean ;
89 namespace ?: string ;
910 workspaceFolder ?: string ;
1011}
@@ -28,14 +29,14 @@ export class NodeBase {
2829 this . fullName = fullName ;
2930 const { workspaceFolder, namespace, extraNode } = options ;
3031 this . workspaceFolder = workspaceFolder || currentWorkspaceFolder ( ) ;
31- this . conn = config ( "conn" , workspaceFolder ) ;
32+ const api = new AtelierAPI ( workspaceFolder ) ;
33+ this . conn = api . config ;
3234 this . namespace = namespace || this . conn . ns ;
3335 this . extraNode = extraNode ;
3436 }
3537
3638 public get connInfo ( ) : string {
37- const port = workspaceState . get ( this . workspaceFolder + ":port" , this . conn . port ) ;
38- return `${ this . conn . host } :${ port } [${ this . namespace } ]` ;
39+ return `${ this . conn . host } :${ this . conn . port } [${ this . namespace } ]` ;
3940 }
4041
4142 public getTreeItem ( ) : vscode . TreeItem {
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ export class RootNode extends NodeBase {
7676
7777 spec = path + spec ;
7878
79- const systemFiles = this . namespace === "%SYS" ? "1" : "0" ;
79+ const systemFiles = this . options . system || this . namespace === "%SYS" ? "1" : "0" ;
8080
8181 const api = new AtelierAPI ( this . workspaceFolder ) ;
8282 api . setNamespace ( this . namespace ) ;
Original file line number Diff line number Diff line change @@ -9,20 +9,24 @@ export class WorkspaceNode extends NodeBase {
99 public uniqueId : string ;
1010 public constructor ( label : string , eventEmitter : vscode . EventEmitter < NodeBase > , options : NodeOptions ) {
1111 super ( label , label , options ) ;
12- this . uniqueId = `serverNode${ this . extraNode ? ":extra:" + this . namespace : "" } ` ;
12+ this . uniqueId = `serverNode: ${ this . namespace } : ${ this . extraNode ? ":extra:" : "" } ` ;
1313 this . options . generated = workspaceState . get ( `ExplorerGenerated:${ this . uniqueId } ` ) ;
14+ this . options . system = workspaceState . get ( `ExplorerSystem:${ this . uniqueId } ` ) ;
1415 this . eventEmitter = eventEmitter ;
1516 }
1617
1718 public getTreeItem ( ) : vscode . TreeItem {
19+ const flags = [ ] ;
20+ this . options . generated && flags . push ( ":generated:" ) ;
21+ this . options . system && flags . push ( ":system:" ) ;
1822 return {
1923 collapsibleState : vscode . TreeItemCollapsibleState . Expanded ,
20- contextValue : `${ this . uniqueId } ${ this . options . generated ? ":generated:" : "" } ` ,
24+ contextValue : `${ this . uniqueId } ${ flags . join ( "" ) } ` ,
2125 label : `${ this . label } (${ this . connInfo } )` ,
2226 } ;
2327 }
2428
25- public async getChildren ( element : NodeBase ) : Promise < NodeBase [ ] > {
29+ public async getChildren ( _element : NodeBase ) : Promise < NodeBase [ ] > {
2630 const children = [ ] ;
2731 let node : RootNode ;
2832
Original file line number Diff line number Diff line change @@ -491,10 +491,18 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
491491 workspaceState . update ( `ExplorerGenerated:${ workspaceNode . uniqueId } ` , true ) ;
492492 return explorerProvider . refresh ( ) ;
493493 } ) ,
494+ vscode . commands . registerCommand ( "vscode-objectscript.explorer.showSystem" , ( workspaceNode : WorkspaceNode ) => {
495+ workspaceState . update ( `ExplorerSystem:${ workspaceNode . uniqueId } ` , true ) ;
496+ return explorerProvider . refresh ( ) ;
497+ } ) ,
494498 vscode . commands . registerCommand ( "vscode-objectscript.explorer.hideGenerated" , ( workspaceNode : WorkspaceNode ) => {
495499 workspaceState . update ( `ExplorerGenerated:${ workspaceNode . uniqueId } ` , false ) ;
496500 return explorerProvider . refresh ( ) ;
497501 } ) ,
502+ vscode . commands . registerCommand ( "vscode-objectscript.explorer.hideSystem" , ( workspaceNode : WorkspaceNode ) => {
503+ workspaceState . update ( `ExplorerSystem:${ workspaceNode . uniqueId } ` , false ) ;
504+ return explorerProvider . refresh ( ) ;
505+ } ) ,
498506 vscode . commands . registerCommand ( "vscode-objectscript.explorer.otherNamespace" , ( workspaceNode : WorkspaceNode ) => {
499507 return explorerProvider . selectNamespace ( workspaceNode . label ) ;
500508 } ) ,
You can’t perform that action at this time.
0 commit comments