Skip to content

Commit 0867307

Browse files
author
Tyler Deemer
committed
Support CSP file compilation, .bas files, and some other files
1 parent be0d0bc commit 0867307

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/api/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ export class AtelierAPI {
2424
return workspaceState.get(this.workspaceFolder + ":iris", false);
2525
}
2626

27+
private formatCspName(filename: string): string {
28+
// If a CSP file, change from
29+
// \csp\user\... to
30+
// csp/user/...
31+
if(filename.startsWith("\\")) {
32+
return filename.substring(1).replace(/\\/g, "\/");
33+
}
34+
return filename;
35+
}
36+
2737
public constructor(wsOrFile?: string | vscode.Uri) {
2838
let workspaceFolderName = "";
2939
if (wsOrFile) {
@@ -267,6 +277,7 @@ export class AtelierAPI {
267277
format,
268278
};
269279
}
280+
name = this.formatCspName(name);
270281
return this.request(1, "GET", `${this.ns}/doc/${name}`, params);
271282
}
272283
// api v1+
@@ -276,6 +287,7 @@ export class AtelierAPI {
276287
// v1+
277288
public putDoc(name: string, data: { enc: boolean; content: string[] }, ignoreConflict?: boolean): Promise<any> {
278289
const params = { ignoreConflict };
290+
name = this.formatCspName(name);
279291
return this.request(1, "PUT", `${this.ns}/doc/${name}`, data, params);
280292
}
281293
// v1+
@@ -317,6 +329,7 @@ export class AtelierAPI {
317329
}
318330
// v1+
319331
public actionCompile(docs: string[], flags?: string, source = false): Promise<any> {
332+
docs = docs.map(doc => this.formatCspName(doc));
320333
return this.request(1, "POST", `${this.ns}/action/compile`, docs, {
321334
flags,
322335
source,

src/explorer/models/rootNode.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class RootNode extends NodeBase {
4444
spec = "*.cls";
4545
break;
4646
case "RTN":
47-
spec = "*.mac,*.int";
47+
spec = "*.mac,*.int,*.bas";
4848
break;
4949
case "INC":
5050
spec = "*.inc";
@@ -115,6 +115,8 @@ export class RootNode extends NodeBase {
115115
case "0":
116116
case "1":
117117
case "2":
118+
case "3":
119+
case "11":
118120
return new RoutineNode(el.Name, el.fullName, this.options);
119121
case "100":
120122
return new ClassNode(el.Name, el.fullName, this.options);

src/utils/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ export function currentFile(document?: vscode.TextDocument): CurrentFile {
5454
if (match) {
5555
[, name, ext = "cls"] = match;
5656
}
57-
} else {
57+
} else if (fileExt === "mac" || fileExt === "int" || fileExt === "inc") {
5858
const match = content.match(/^ROUTINE ([^\s]+)(?:\s*\[\s*Type\s*=\s*\b([a-z]{3})\b)?/i);
5959
if (match) {
6060
[, name, ext = "mac"] = match;
6161
} else {
6262
[name, ext = "mac"] = path.basename(document.fileName).split(".");
6363
}
64+
} else {
65+
name = fileName;
6466
}
6567
if (!name) {
6668
return null;

0 commit comments

Comments
 (0)