-
Notifications
You must be signed in to change notification settings - Fork 116
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
Matching multiline text #211
Comments
(I'm just a random guy that does a lot of highlighting not a VS Code contributor btw)
There's only two tools in Textmate parsers (VS Code and many editors use Textmate grammars for highlighting).
Thats it. So you could get creative, use a pattern range, have it start with group 1, have it end when it sees a blank line, and then restrict what patterns are allowed inside of the pattern range. Here's some code snippets to show a little bit of what I mean. "What if the start-trigger/start-pattern requires multiple lines to be identified?" Well then you're straight outta luck. Textmate parsers are hacky, very-limited things. Its actually more amazing that they work at all. Stuff like the C++ pre-processor just straight up break it with no good workaround. Its sad but that's how it is. One day (maybe) VS Code will switch to the Tree Sitter Parser and these problems won't exist. |
You could try using semantic tokens. There you can look at the entire file contents when creating them, not just one line at a time, looking for patterns. You can create an extension that uses a nodejs language server and our libraries for that. They are fit for running in a web worker, and creating a new worker on the web or a new nodejs process on the desktop. In our codebase, you can take a look at css. |
My language has syntax that is structured as follows:
There are sets of one "Group 1" followed by any number of "Group 2" before a blank line, after which another set starts. I want
Group 1
highlighted differently thanGroup 2
. There are no identifying features within the line, just its place within the file. I tried using newlines in a regex to capture these but it didn't work, and it seems that VSCode only goes one line at a time for the regex.I can't use a language server since this needs to work in VSCode web, how can I achieve this highlighting?
The text was updated successfully, but these errors were encountered: