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 193
193
{
194
194
"command" : " vscode-objectscript.explorer.hideGenerated" ,
195
195
"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:/"
196
204
}
197
205
],
198
206
"editor/context" : [
402
410
"title" : " Hide Generated" ,
403
411
"category" : " ObjectScript"
404
412
},
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
+ },
405
423
{
406
424
"command" : " vscode-objectscript.explorer.otherNamespaceClose" ,
407
425
"title" : " Close Namespace" ,
Original file line number Diff line number Diff line change 1
1
import * as vscode from "vscode" ;
2
- import { config , workspaceState } from "../../extension" ;
3
2
import { currentWorkspaceFolder } from "../../utils" ;
3
+ import { AtelierAPI } from "../../api" ;
4
4
5
5
export interface NodeOptions {
6
6
extraNode ?: boolean ;
7
7
generated ?: boolean ;
8
+ system ?: boolean ;
8
9
namespace ?: string ;
9
10
workspaceFolder ?: string ;
10
11
}
@@ -28,14 +29,14 @@ export class NodeBase {
28
29
this . fullName = fullName ;
29
30
const { workspaceFolder, namespace, extraNode } = options ;
30
31
this . workspaceFolder = workspaceFolder || currentWorkspaceFolder ( ) ;
31
- this . conn = config ( "conn" , workspaceFolder ) ;
32
+ const api = new AtelierAPI ( workspaceFolder ) ;
33
+ this . conn = api . config ;
32
34
this . namespace = namespace || this . conn . ns ;
33
35
this . extraNode = extraNode ;
34
36
}
35
37
36
38
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 } ]` ;
39
40
}
40
41
41
42
public getTreeItem ( ) : vscode . TreeItem {
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ export class RootNode extends NodeBase {
76
76
77
77
spec = path + spec ;
78
78
79
- const systemFiles = this . namespace === "%SYS" ? "1" : "0" ;
79
+ const systemFiles = this . options . system || this . namespace === "%SYS" ? "1" : "0" ;
80
80
81
81
const api = new AtelierAPI ( this . workspaceFolder ) ;
82
82
api . setNamespace ( this . namespace ) ;
Original file line number Diff line number Diff line change @@ -9,20 +9,24 @@ export class WorkspaceNode extends NodeBase {
9
9
public uniqueId : string ;
10
10
public constructor ( label : string , eventEmitter : vscode . EventEmitter < NodeBase > , options : NodeOptions ) {
11
11
super ( label , label , options ) ;
12
- this . uniqueId = `serverNode${ this . extraNode ? ":extra:" + this . namespace : "" } ` ;
12
+ this . uniqueId = `serverNode: ${ this . namespace } : ${ this . extraNode ? ":extra:" : "" } ` ;
13
13
this . options . generated = workspaceState . get ( `ExplorerGenerated:${ this . uniqueId } ` ) ;
14
+ this . options . system = workspaceState . get ( `ExplorerSystem:${ this . uniqueId } ` ) ;
14
15
this . eventEmitter = eventEmitter ;
15
16
}
16
17
17
18
public getTreeItem ( ) : vscode . TreeItem {
19
+ const flags = [ ] ;
20
+ this . options . generated && flags . push ( ":generated:" ) ;
21
+ this . options . system && flags . push ( ":system:" ) ;
18
22
return {
19
23
collapsibleState : vscode . TreeItemCollapsibleState . Expanded ,
20
- contextValue : `${ this . uniqueId } ${ this . options . generated ? ":generated:" : "" } ` ,
24
+ contextValue : `${ this . uniqueId } ${ flags . join ( "" ) } ` ,
21
25
label : `${ this . label } (${ this . connInfo } )` ,
22
26
} ;
23
27
}
24
28
25
- public async getChildren ( element : NodeBase ) : Promise < NodeBase [ ] > {
29
+ public async getChildren ( _element : NodeBase ) : Promise < NodeBase [ ] > {
26
30
const children = [ ] ;
27
31
let node : RootNode ;
28
32
Original file line number Diff line number Diff line change @@ -491,10 +491,18 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
491
491
workspaceState . update ( `ExplorerGenerated:${ workspaceNode . uniqueId } ` , true ) ;
492
492
return explorerProvider . refresh ( ) ;
493
493
} ) ,
494
+ vscode . commands . registerCommand ( "vscode-objectscript.explorer.showSystem" , ( workspaceNode : WorkspaceNode ) => {
495
+ workspaceState . update ( `ExplorerSystem:${ workspaceNode . uniqueId } ` , true ) ;
496
+ return explorerProvider . refresh ( ) ;
497
+ } ) ,
494
498
vscode . commands . registerCommand ( "vscode-objectscript.explorer.hideGenerated" , ( workspaceNode : WorkspaceNode ) => {
495
499
workspaceState . update ( `ExplorerGenerated:${ workspaceNode . uniqueId } ` , false ) ;
496
500
return explorerProvider . refresh ( ) ;
497
501
} ) ,
502
+ vscode . commands . registerCommand ( "vscode-objectscript.explorer.hideSystem" , ( workspaceNode : WorkspaceNode ) => {
503
+ workspaceState . update ( `ExplorerSystem:${ workspaceNode . uniqueId } ` , false ) ;
504
+ return explorerProvider . refresh ( ) ;
505
+ } ) ,
498
506
vscode . commands . registerCommand ( "vscode-objectscript.explorer.otherNamespace" , ( workspaceNode : WorkspaceNode ) => {
499
507
return explorerProvider . selectNamespace ( workspaceNode . label ) ;
500
508
} ) ,
You can’t perform that action at this time.
0 commit comments