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 196
196
{
197
197
"command" : " vscode-objectscript.explorer.hideGenerated" ,
198
198
"when" : " view == ObjectScriptExplorer && viewItem =~ /^serverNode.*:generated:/"
199
+ },
200
+ {
201
+ "command" : " vscode-objectscript.explorer.showSystem" ,
202
+ "when" : " view == ObjectScriptExplorer && viewItem =~ /^serverNode((?!:(%SYS|system):).)*$/"
203
+ },
204
+ {
205
+ "command" : " vscode-objectscript.explorer.hideSystem" ,
206
+ "when" : " view == ObjectScriptExplorer && viewItem =~ /^serverNode.*:system:/"
199
207
}
200
208
],
201
209
"editor/context" : [
401
409
"title" : " Hide Generated" ,
402
410
"category" : " ObjectScript"
403
411
},
412
+ {
413
+ "command" : " vscode-objectscript.explorer.showSystem" ,
414
+ "title" : " Show System" ,
415
+ "category" : " ObjectScript"
416
+ },
417
+ {
418
+ "command" : " vscode-objectscript.explorer.hideSystem" ,
419
+ "title" : " Hide System" ,
420
+ "category" : " ObjectScript"
421
+ },
404
422
{
405
423
"command" : " vscode-objectscript.explorer.otherNamespaceClose" ,
406
424
"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 @@ -75,7 +75,7 @@ export class RootNode extends NodeBase {
75
75
76
76
spec = path + spec ;
77
77
78
- const systemFiles = this . namespace === "%SYS" ? "1" : "0" ;
78
+ const systemFiles = this . options . system || this . namespace === "%SYS" ? "1" : "0" ;
79
79
80
80
const api = new AtelierAPI ( this . workspaceFolder ) ;
81
81
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 ) : 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 @@ -460,10 +460,18 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
460
460
workspaceState . update ( `ExplorerGenerated:${ workspaceNode . uniqueId } ` , true ) ;
461
461
return explorerProvider . refresh ( ) ;
462
462
} ) ,
463
+ vscode . commands . registerCommand ( "vscode-objectscript.explorer.showSystem" , ( workspaceNode : WorkspaceNode ) => {
464
+ workspaceState . update ( `ExplorerSystem:${ workspaceNode . uniqueId } ` , true ) ;
465
+ return explorerProvider . refresh ( ) ;
466
+ } ) ,
463
467
vscode . commands . registerCommand ( "vscode-objectscript.explorer.hideGenerated" , ( workspaceNode : WorkspaceNode ) => {
464
468
workspaceState . update ( `ExplorerGenerated:${ workspaceNode . uniqueId } ` , false ) ;
465
469
return explorerProvider . refresh ( ) ;
466
470
} ) ,
471
+ vscode . commands . registerCommand ( "vscode-objectscript.explorer.hideSystem" , ( workspaceNode : WorkspaceNode ) => {
472
+ workspaceState . update ( `ExplorerSystem:${ workspaceNode . uniqueId } ` , false ) ;
473
+ return explorerProvider . refresh ( ) ;
474
+ } ) ,
467
475
vscode . commands . registerCommand ( "vscode-objectscript.explorer.otherNamespace" , ( workspaceNode : WorkspaceNode ) => {
468
476
return explorerProvider . selectNamespace ( workspaceNode . label ) ;
469
477
} ) ,
You can’t perform that action at this time.
0 commit comments