Skip to content

Commit 872e8a2

Browse files
committed
not so strict about spaces in header of routines. fixes #111
1 parent 96b4f7a commit 872e8a2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/utils/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function currentFile(document?: vscode.TextDocument): CurrentFile {
5555
[, name, ext = "cls"] = match;
5656
}
5757
} else {
58-
const match = content.match(/^ROUTINE ([^\s]+)(?:\s+\[.*Type=([a-z]{3,}))?/i);
58+
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 {
@@ -65,7 +65,7 @@ export function currentFile(document?: vscode.TextDocument): CurrentFile {
6565
if (!name) {
6666
return null;
6767
}
68-
name += ext ? "." + ext : "";
68+
name += ext ? "." + ext.toLowerCase() : "";
6969

7070
return {
7171
content,

syntaxes/objectscript-macros.tmLanguage.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
"name": "objectscript_macros",
44
"scopeName": "source.objectscript_macros",
55
"patterns": [
6+
{
7+
"match": "^(ROUTINE)\\s(\\b[a-zA-Z0-9.]+\\b)",
8+
"captures": {
9+
"1": { "name": "keyword.control" },
10+
"2": { "name": "entity.name.class" }
11+
}
12+
},
613
{ "include": "#include" },
714
{ "include": "#dim" },
815
{ "include": "#define" },

0 commit comments

Comments
 (0)