Skip to content

Commit

Permalink
fixed errors in &js[cript] (fixed #108)
Browse files Browse the repository at this point in the history
  • Loading branch information
daimor committed Apr 1, 2020
1 parent 704a046 commit 93cda6e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/providers/ObjectScriptDiagnosticProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export class ObjectScriptDiagnosticProvider {
let endingComma = false;
let isCode = !isClass;
let jsScript = false;
let js = false;
let jsParens = 0;
let sql = false;
let sqlParens = 0;
for (let i = 0; i < document.lineCount; i++) {
Expand All @@ -108,6 +110,18 @@ export class ObjectScriptDiagnosticProvider {
jsScript = true;
}

if (text.match(/&js(cript)?/i)) {
js = true;
jsParens = 0;
}
if (js) {
jsParens = jsParens + (text.split("<").length - 1) - (text.split(">").length - 1);
if (jsParens <= 0) {
js = false;
}
continue;
}

if (text.match(/&sql/i)) {
sql = true;
sqlParens = 0;
Expand Down
4 changes: 2 additions & 2 deletions syntaxes/objectscript.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"embeddedSQL": {
"patterns": [
{
"begin": "(&sql)(\\()",
"begin": "(?i)(&sql)(\\()",
"beginCaptures": {
"1": { "name": "keyword.special.sql.objectscript" },
"2": { "name": "punctuation.objectscript" }
Expand All @@ -74,7 +74,7 @@
"embeddedJS": {
"patterns": [
{
"begin": "(&js)(<)",
"begin": "(?i)(&js(cript)?)(<)",
"beginCaptures": {
"1": { "name": "keyword.special.js.objectscript" },
"2": { "name": "punctuation.objectscript" }
Expand Down

0 comments on commit 93cda6e

Please sign in to comment.