-
Notifications
You must be signed in to change notification settings - Fork 47
Add CSP and other files to explorer #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
be0d0bc
0867307
2223fc8
a7d50af
e2fcbaf
c725c79
c64332b
ecf8b4c
c48e8b3
ea9d73a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,20 @@ import { ClassNode } from "./classesNode"; | |
export class RootNode extends NodeBase { | ||
public readonly contextValue: string; | ||
private readonly _category: string; | ||
private readonly isCsp: boolean; | ||
|
||
public constructor(label: string, fullName: string, contextValue: string, category: string, options: NodeOptions) { | ||
public constructor( | ||
label: string, | ||
fullName: string, | ||
contextValue: string, | ||
category: string, | ||
options: NodeOptions, | ||
isCsp = false | ||
) { | ||
super(label, fullName, options); | ||
this.contextValue = contextValue; | ||
this._category = category; | ||
this.isCsp = isCsp; | ||
} | ||
|
||
public get category(): string { | ||
|
@@ -29,7 +38,7 @@ export class RootNode extends NodeBase { | |
} | ||
|
||
public async getChildren(element): Promise<NodeBase[]> { | ||
const path = this instanceof PackageNode ? this.fullName + "/" : ""; | ||
const path = this instanceof PackageNode || this.isCsp ? this.fullName + "/" : ""; | ||
return this.getItems(path, this._category); | ||
} | ||
|
||
|
@@ -42,14 +51,20 @@ export class RootNode extends NodeBase { | |
spec = "*.cls"; | ||
break; | ||
case "RTN": | ||
spec = "*.mac,*.int"; | ||
spec = "*.mac,*.int,*.bas"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not? |
||
break; | ||
case "INC": | ||
spec = "*.inc"; | ||
break; | ||
case "ALL": | ||
spec = "*.cls,*.mac,*.int,*.inc"; | ||
break; | ||
case "CSP": | ||
spec = "*"; | ||
break; | ||
case "OTHER": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OTHER replace everywhere with OTH, to be consistent with Atelier API |
||
spec = "*"; | ||
break; | ||
default: | ||
return; | ||
} | ||
|
@@ -72,7 +87,12 @@ export class RootNode extends NodeBase { | |
}) | ||
.then((data) => | ||
data.map((el) => { | ||
const fullName = (this instanceof PackageNode ? this.fullName + "." : "") + el.Name; | ||
let fullName = el.Name; | ||
if (this instanceof PackageNode) { | ||
fullName = this.fullName + "." + el.Name; | ||
} else if (this.isCsp) { | ||
fullName = this.fullName + "/" + el.Name; | ||
} | ||
return { | ||
...el, | ||
fullName, | ||
|
@@ -84,6 +104,15 @@ export class RootNode extends NodeBase { | |
public getItems(path: string, category: string): Promise<NodeBase[]> { | ||
return this.getList(path, category, false).then((data) => | ||
data | ||
.filter((el) => { | ||
if (category === "OTHER") { | ||
return el.Type === "100"; | ||
} else if (category === "CSP") { | ||
return el.Type === "10" || el.Type === "5"; | ||
} else { | ||
return true; | ||
} | ||
}) | ||
.map((el) => { | ||
switch (el.Type) { | ||
case "9": | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
|
@@ -93,7 +122,15 @@ export class RootNode extends NodeBase { | |
case "0": | ||
case "1": | ||
case "2": | ||
case "3": | ||
case "11": | ||
return new RoutineNode(el.Name, el.fullName, this.options); | ||
case "100": | ||
return new ClassNode(el.Name, el.fullName, this.options); | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
case "10": | ||
return new RootNode(el.Name, el.fullName, "dataNode:CSPApplication", this._category, this.options, true); | ||
case "5": | ||
return new ClassNode(el.Name, el.fullName, this.options); | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
default: | ||
return null; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,10 +61,17 @@ export class DocumentContentProvider implements vscode.TextDocumentContentProvid | |
}); | ||
} | ||
} | ||
const isCsp = name.split("/")[0] === "csp"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, that's not a rule. CSP application may have any name. You need a better way to check if it's a CSP. |
||
if (namespace && namespace !== "") { | ||
uri = uri.with({ | ||
query: `ns=${namespace}`, | ||
}); | ||
if (isCsp) { | ||
uri = uri.with({ | ||
query: `ns=${namespace}&csp=1`, | ||
}); | ||
} else { | ||
uri = uri.with({ | ||
query: `ns=${namespace}`, | ||
}); | ||
} | ||
} | ||
return uri; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.