language-haskell icon indicating copy to clipboard operation
language-haskell copied to clipboard

{-# SCC "Specialise" #-} messes up the color of text after it

Open zliu41 opened this issue 4 years ago • 4 comments

Screenshot from 2021-08-25 11-26-36

zliu41 avatar Aug 25 '21 18:08 zliu41

Thanks for the bug report. I think the rule for SPECIALI(S|Z)E should check that it is preceded by a space and not just a word boundary.

sheaf avatar Aug 25 '21 18:08 sheaf

Thanks. Seems like a fairly small fix, which I would often do myself, but I didn't find any instructions for running tests in this repo, and the tests don't work for me, with some unhelpful error messages:

$ make test
cd test && bash test.sh
Running tests from base directory /home/zliu41/language-haskell
undefined:1



SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.t.parseRawGrammar (/home/zliu41/.npm/_npx/0730124e18183807/node_modules/vscode-textmate/release/main.js:1:20933)
    at createRegistryFromGrammars (/home/zliu41/.npm/_npx/0730124e18183807/node_modules/vscode-tmgrammar-test/dist/src/unit/index.js:115:29)
    at Object.createRegistry (/home/zliu41/.npm/_npx/0730124e18183807/node_modules/vscode-tmgrammar-test/dist/src/unit/index.js:141:12)
    at Object.<anonymous> (/home/zliu41/.npm/_npx/0730124e18183807/node_modules/vscode-tmgrammar-test/dist/src/unit.js:60:24)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
npm ERR! code 1
npm ERR! path /home/zliu41/language-haskell/test
npm ERR! command failed
npm ERR! command sh -c vscode-tmgrammar-test "-s" "source.haskell" "-g" "/home/zliu41/language-haskell/syntaxes/haskell.json" "-t" "/home/zliu41/language-haskell/test/tests/ADTs.hs"

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/zliu41/.npm/_logs/2021-08-27T20_13_23_965Z-debug.log
Fail (unexpected) ADTs.hs
...

This prevents me from validating my changes. Some instructions in README would be helpful.

zliu41 avatar Aug 27 '21 20:08 zliu41

Hmm, sorry about that. What happens if you run:

npx vscode-tmgrammar-test "-s" "source.haskell" "-g" "/home/zliu41/language-haskell/syntaxes/haskell.json" "-t" "/home/zliu41/language-haskell/test/tests/ADTs.hs"

Thanks for taking the time to help, I appreciate it.

sheaf avatar Aug 27 '21 20:08 sheaf

By the way, to change the syntax grammar you should be editing the haskell.YAML-tmLanguage file, and then generating haskell.json using npx js-yaml haskell.YAML-tmLanguage > haskell.json. I will add instructions to the README, thank you.

sheaf avatar Aug 27 '21 20:08 sheaf