Open CareyJWilliams opened 2 years ago
I don't know if it'll help, but you can add a boundary anchor \b
to the regex, forcing it to match the exact word:
'))\\b.*\\s*$'
I don't know if it'll help, but you can add a boundary anchor
\b
to the regex, forcing it to match the exact word:'))\\b.*\\s*$'
Thanks Dan, I haven't yet had a chance to look at this (and many other bugs) in any great detail. Your suggestion certainly sounds feasible though, and I'd be very happy to take a PR ;)
Sure, but you'll have to walk me through how to build it so I can test before pushing. 😅
Sure, but you'll have to walk me through how to build it so I can test before pushing. 😅
npm install .
in the directorynpm run release
npm run test
(unit) and npm run smoketest
(integration)There aren't actually any unit tests for ChoiceScript yet, because Monarch unit tests are extremely painful to write and I'm expecting a lot of churn in this area.
Run them anyway just to make sure something hasn't gone horribly wrong, and then use a web-server to perform manual testing: e.g. python -m http.server
and navigate to test/manual/index.html in a browser. Select ChoiceScript as the language (and sample) and ensure you're using a cs-* theme (or things won't highlight correctly):
There's documentation and a playground for Monarch (the grammar framework) here: https://microsoft.github.io/monaco-editor/monarch.html.
That should get you going, but feel free to shout if you've got any more specific questions.
Don't worry about the validation errors, they're from the language server (which is very buggy atm) rather than the tokenizer.
The basic-language support in ChoicescriptIDE/monaco-editor defines the "smart" indentation behaviour based on RegExes. Whilst implementing *ifid I noticed that it's incorrectly treated as a indenting command, because the 'if' part is matched. Unfortunately this seems to extend to invalid commands as well, for e.g.:
*ifishouldnotiwouldnot
Will trigger an automatic indent.