Skip to content
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

Incorrect syntax highlighting for "hidden" opening parentheses #114

Open
ojwb opened this issue Nov 18, 2024 · 3 comments
Open

Incorrect syntax highlighting for "hidden" opening parentheses #114

ojwb opened this issue Nov 18, 2024 · 3 comments

Comments

@ojwb
Copy link
Collaborator

ojwb commented Nov 18, 2024

Example:

https://bbcmic.ro/#%7B%22v%22%3A1%2C%22program%22%3A%22A%24%3D%5C%22OWLET%5C%22%3AP.RI.A%24%2C1%29LE.A%24%2C2%29MI.A%24%2C4%2C1%29MI.A%24%2C3%2C1%29%22%7D

RI. is an abbreviation for RIGHT$( (so there's an open parenthesis but it's "hidden") - however owlet colours the corresponding closing ) in red because it thinks there's a missing opening ( (and similarly for all such cases it seems).

It seems bracket syntax highlighting uses a builtin feature of the editor component so this may not be easy to fix:

brackets: [["(", ")", "delimiter.parenthesis"]],
@ojwb
Copy link
Collaborator Author

ojwb commented Jan 21, 2025

I found https://microsoft.github.io/monaco-editor/monarch-static.html#complexmatch - it seems the abbreviated token with the hidden opening parenthesis (e.g. RI.) would need to have the same token class as the closing parenthesis though. We can't really change the latter without doing our own matching of parentheses, so I guess we'd need to make RI.'s token class delimiter.parenthesis and similarly for all the abbreviated tokens with a hidden (. Not ideal but better than mishighlighting the closing parenthesis as unmatched.

@mattgodbolt
Copy link
Owner

Amazing stuff olly; thanks for this! How much are you using owlet!? 😀

@ojwb
Copy link
Collaborator Author

ojwb commented Jan 22, 2025

Arguably too much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants