Skip to content

Commit

Permalink
Merge pull request #339 from FedericoPonzi/issue-284
Browse files Browse the repository at this point in the history
Fix broken syntax highlighting after the first submodule
  • Loading branch information
FedericoPonzi authored Sep 29, 2024
2 parents 9b9493f + fc0364f commit 250ef51
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
3 changes: 3 additions & 0 deletions languages/tlaplus-grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@
}
},
"patterns": [
{
"include" : "#module"
},
{
"include": "#pluscal"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
"watch": "npm run compile -- --watch",
"pretest": "tsc -p ./",
"test": "node ./out/tests/runTest.js",
"test:tlaplus-grammar": "vscode-tmgrammar-test ./tests/suite/languages/tlaplus-grammar-test.tla -g ./languages/tlaplus-grammar.json -g ./languages/pluscal-grammar.json"
"test:tlaplus-grammar": "vscode-tmgrammar-test ./tests/suite/languages/tlaplus-grammar-test.tla ./tests/suite/languages/tlaplus-grammar-test-submodule.tla -g ./languages/tlaplus-grammar.json -g ./languages/pluscal-grammar.json"
},
"devDependencies": {
"@types/glob": "^8.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/tla2tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const cmodsJarPath = path.resolve(__dirname, '../tools/' + TLA_CMODS_LIB_NAME);
const javaCmd = 'java' + (process.platform === 'win32' ? '.exe' : '');
const javaVersionChannel = new ToolOutputChannel('TLA+ Java version');
const TLA_TOOLS_STANDARD_MODULES = '/tla2sany/StandardModules';
const TLA_TOOLS_PLUSCAL_PARAM_SKIP_CFG_CREATION = "-nocfg";
const TLA_TOOLS_PLUSCAL_PARAM_SKIP_CFG_CREATION = '-nocfg';

let lastUsedJavaHome: string | undefined;
let cachedJavaPath: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion tests/suite/languages/GrammarTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Grammar tests are defined under [tests/suite/languages](.)

A grammar test is a test file that includes annotation of the expected assigned scopes. One example is the [tlaplus-grammar-test.tla](tlaplus-grammar-test.tla).

For more information on how to write a test see [vscode-tmgrammar-test](thttps://github.com/PanAeon/vscode-tmgrammar-test).
For more information on how to write a test see [vscode-tmgrammar-test](https://github.com/PanAeon/vscode-tmgrammar-test).

## Run the tests
To run from the command line:
Expand Down
37 changes: 37 additions & 0 deletions tests/suite/languages/tlaplus-grammar-test-submodule.tla
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SYNTAX TEST "source.tlaplus" "tlaplus language grammar testcase"

---- MODULE SubmoduleTest ----
// <---- comment.line
// ^^^^^^ keyword.other
// ^^^^^^^^^^^^^ entity.name.class
---- MODULE InnerModule1 ----
// <---- comment.line
// ^^^^^^ keyword.other
// ^^^^^^^^^^^^ entity.name.class

Op1 == FALSE
//<-- support.type.primitive
// ^^^^^ support.constant.tlaplus

====
// <---- comment.line

---- MODULE InnerModule2 ----
// <---- comment.line
// ^^^^^^ keyword.other
// ^^^^^^^^^^^^ entity.name.class

Op2 == FALSE
//<-- support.type.primitive
// ^^^^^ support.constant.tlaplus


====
// <---- comment.line

Op == FALSE
//<-- support.type.primitive
// ^^^^^ support.constant.tlaplus

====
// <---- comment.line

0 comments on commit 250ef51

Please sign in to comment.