Skip to content

Commit be0d0bc

Browse files
author
Tyler Deemer
committed
Display CSP and Other files in explorer
1 parent 4e4d67f commit be0d0bc

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed

src/explorer/models/rootNode.ts

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import { ClassNode } from "./classesNode";
99
export class RootNode extends NodeBase {
1010
public readonly contextValue: string;
1111
private readonly _category: string;
12+
private readonly isCsp: boolean;
1213

13-
public constructor(label: string, fullName: string, contextValue: string, category: string, options: NodeOptions) {
14+
public constructor(label: string, fullName: string, contextValue: string, category: string, options: NodeOptions, isCsp = false) {
1415
super(label, fullName, options);
1516
this.contextValue = contextValue;
1617
this._category = category;
18+
this.isCsp = isCsp;
1719
}
1820

1921
public get category(): string {
@@ -29,7 +31,7 @@ export class RootNode extends NodeBase {
2931
}
3032

3133
public async getChildren(element): Promise<NodeBase[]> {
32-
const path = this instanceof PackageNode ? this.fullName + "/" : "";
34+
const path = (this instanceof PackageNode || this.isCsp) ? this.fullName + "/" : "";
3335
return this.getItems(path, this._category);
3436
}
3537

@@ -50,6 +52,12 @@ export class RootNode extends NodeBase {
5052
case "ALL":
5153
spec = "*.cls,*.mac,*.int,*.inc";
5254
break;
55+
case "CSP":
56+
spec = "*";
57+
break;
58+
case "OTHER":
59+
spec = "*";
60+
break;
5361
default:
5462
return;
5563
}
@@ -72,7 +80,12 @@ export class RootNode extends NodeBase {
7280
})
7381
.then(data =>
7482
data.map(el => {
75-
const fullName = (this instanceof PackageNode ? this.fullName + "." : "") + el.Name;
83+
let fullName = el.Name;
84+
if(this instanceof PackageNode) {
85+
fullName = this.fullName + "." + el.Name;
86+
} else if(this.isCsp) {
87+
fullName = this.fullName + "/" + el.Name;
88+
}
7689
return {
7790
...el,
7891
fullName,
@@ -84,6 +97,15 @@ export class RootNode extends NodeBase {
8497
public getItems(path: string, category: string): Promise<NodeBase[]> {
8598
return this.getList(path, category, false).then(data =>
8699
data
100+
.filter(el => {
101+
if(category === "OTHER") {
102+
return el.Type === "100";
103+
} else if(category === "CSP") {
104+
return el.Type === "10" || el.Type === "5"
105+
} else {
106+
return true;
107+
}
108+
})
87109
.map(el => {
88110
switch (el.Type) {
89111
case "9":
@@ -94,6 +116,12 @@ export class RootNode extends NodeBase {
94116
case "1":
95117
case "2":
96118
return new RoutineNode(el.Name, el.fullName, this.options);
119+
case "100":
120+
return new ClassNode(el.Name, el.fullName, this.options);
121+
case "10":
122+
return new RootNode(el.Name, el.fullName, this.contextValue, this._category, this.options, true);
123+
case "5":
124+
return new ClassNode(el.Name, el.fullName, this.options);
97125
default:
98126
return null;
99127
}

src/explorer/models/workspaceNode.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ export class WorkspaceNode extends NodeBase {
3535
node = new RootNode("Includes", "", "dataRootNode:routinesRootNode", "INC", this.options);
3636
children.push(node);
3737

38+
node = new RootNode("CSP Files", "", "dataRootNode:cspRootNode", "CSP", this.options);
39+
children.push(node);
40+
41+
node = new RootNode("Other", "", "dataRootNode:otherRootNode", "OTHER", this.options);
42+
children.push(node);
43+
3844
return children;
3945
}
4046
}

src/providers/DocumentContentProvider.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,17 @@ export class DocumentContentProvider implements vscode.TextDocumentContentProvid
6161
});
6262
}
6363
}
64+
const isCsp = name.split("/")[0] === "csp";
6465
if (namespace && namespace !== "") {
65-
uri = uri.with({
66-
query: `ns=${namespace}`,
67-
});
66+
if(isCsp) {
67+
uri = uri.with({
68+
query: `ns=${namespace}&csp=1`,
69+
});
70+
} else {
71+
uri = uri.with({
72+
query: `ns=${namespace}`,
73+
});
74+
}
6875
}
6976
return uri;
7077
}

0 commit comments

Comments
 (0)