Skip to content

Commit 93cda6e

Browse files
committed
fixed errors in &js[cript] (fixed #108)
1 parent 704a046 commit 93cda6e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/providers/ObjectScriptDiagnosticProvider.ts

+14
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ export class ObjectScriptDiagnosticProvider {
9696
let endingComma = false;
9797
let isCode = !isClass;
9898
let jsScript = false;
99+
let js = false;
100+
let jsParens = 0;
99101
let sql = false;
100102
let sqlParens = 0;
101103
for (let i = 0; i < document.lineCount; i++) {
@@ -108,6 +110,18 @@ export class ObjectScriptDiagnosticProvider {
108110
jsScript = true;
109111
}
110112

113+
if (text.match(/&js(cript)?/i)) {
114+
js = true;
115+
jsParens = 0;
116+
}
117+
if (js) {
118+
jsParens = jsParens + (text.split("<").length - 1) - (text.split(">").length - 1);
119+
if (jsParens <= 0) {
120+
js = false;
121+
}
122+
continue;
123+
}
124+
111125
if (text.match(/&sql/i)) {
112126
sql = true;
113127
sqlParens = 0;

syntaxes/objectscript.tmLanguage.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"embeddedSQL": {
6161
"patterns": [
6262
{
63-
"begin": "(&sql)(\\()",
63+
"begin": "(?i)(&sql)(\\()",
6464
"beginCaptures": {
6565
"1": { "name": "keyword.special.sql.objectscript" },
6666
"2": { "name": "punctuation.objectscript" }
@@ -74,7 +74,7 @@
7474
"embeddedJS": {
7575
"patterns": [
7676
{
77-
"begin": "(&js)(<)",
77+
"begin": "(?i)(&js(cript)?)(<)",
7878
"beginCaptures": {
7979
"1": { "name": "keyword.special.js.objectscript" },
8080
"2": { "name": "punctuation.objectscript" }

0 commit comments

Comments
 (0)