-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monarch grammar: Regex starting with ^ should only match start of source line, but it does not. #1818
Comments
Stepping through the code, I believe the issue is that In particular, it does this check:
By comparison, when in an embedded grammar, I believe |
Ah, so the issue is a bit more subtle than I realized. In wrapping it in As such, this check in since those characters should have been added by I suspect the fix might be as simple as changing this code: To be something like:
Though it would probably be slightly more efficient to rewrite the Also, I think the |
I'm trying to fix this myself and I have been following the instructions on I followed the instructions for I poked around the various It would be helpful if the docs provided more detail about how the maintainers get a good dev cycle going. |
…xiting embedded mode
@bolinfest The trick is to use It usually just means that you edit the |
@alexdima I had that working for the establish test pages, but it did not seem to be working for the playground (which I cared about because I didn't see a good test page for grammars, so I wanted to use |
For testing changes like that, I typically use one of the generated files like at http://127.0.0.1:8080/monaco-editor/test/playground.generated/extending-language-services-custom-languages.html and just edit the |
Fixes microsoft/monaco-editor#1818: check matchOnlyAtLineStart when e…
…xiting embedded mode
monaco-editor version: 0.19.3
Browser: Chrome 79
OS: macOS
Playground code that reproduces the issue:
According to the Monarch docs:
I have tried both specifying a regex literal
/^!/
as well as a string"^!"
, but neither works.You can reproduce the issue on the special Monarch playground at https://microsoft.github.io/monaco-editor/monarch.html. In the Language syntax definition, specify:
And then in the Language editor, specify:
If you look carefully, the JSON inside the
!
starts out being highlighted correctly, but after the!
in the string literal"bar!"
, it stops working. It appears the/^\!/
has matched it even though it is not the start of a source code line, which is not what the docs claim should happen.The text was updated successfully, but these errors were encountered: