-
Notifications
You must be signed in to change notification settings - Fork 5
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
(Support regex in strings) - Broken syntax highlighting when quoted string starts with / #12
Comments
Thanks for reporting the issue. The issue is with a start of In the meantime, does this work |
Is there a way the regular expression part of the highlighter can be made optional maybe? |
Currently, the only workaround would be to use the following approach
Ideally, I would like to have the regex highlighting but not have it present when a template path is provided. However, this should be a temporary problem until I can have a fix for it in place. Let me know if you run into any issues. |
That workaround is working well for me, thank you for the prompt response! |
I'm having the same issue. Indeed often it isn't possible to start the string differently. Btw, regex doesn't have to start & end with slashes. Any character that is repeated is allowed, or matching brackets. E.g. Isn't the solution to recognizing this correctly that it should have |
the workaround by commenting out lines 355 to 373 no longer works. What are the appropriate lines to comment out now? Maybe show the actual text so in future they can be mapped. |
You can just remove line https://github.com/Sublime-Instincts/BetterTwig/blob/master/resources/syntax/Twig.sublime-syntax#L359 |
I remove lines 359 & 361 and the syntax highlighting is still broken. Then removed lines 364-382 and still broken. |
Removing 364 - 382 should definitely have helped, since those are the offending contexts. Did you create the override as mentioned here #12 (comment) (Ideally, I'd like to fix this without overrides, but short of time at the moment). |
Yes I created the override in Packages/BetterTwig/resources/syntax/Twig.sublime-syntax I deleted lines 359, 361 and 364-382 and restarted Sublime. Still broken. BTW I am using Sublime Text 4 Build 4107 |
The ST build shouldn't matter since the syntax is not using any ST4 specific features. Could you provide a sample code block so that I can try & reproduce locally ? |
Could you try |
I am on Macos Big Sur 11.4. Renaming BetterTwig to Twig worked. I checked Installed Packages and it is Twig.sublime-package. |
I'm also experiencing this. +1 for @lode's suggestion above. |
Hi, any pernament solutions or plan for it? I didn't check yet your workaround for my problem, so let you know tommorow. But, I will leave trace my issue similar with Longer part code, the same as reference image:
|
I have pushed a new tag release that removes the context that causes it. So the syntax highlighting should now be not broken. For everyone else in this thread, please delete any |
Summary
Syntax highlighting is broken when the template contains a quoted string starting with / such as "/_skeleton.html" or '/_skeleton.html' - the highlight no longer recognises the end of the string.
Expected Behaviour
Correct highlighting regardless of contents of quoted string
Actual Behaviour
Syntax highlighting is broken when the template contains a quoted string starting with / such as "/_skeleton.html" or '/_skeleton.html' - the highlight no longer recognises the end of the string.
How to Reproduce
Problematic Twig template.
Or
Environment
The text was updated successfully, but these errors were encountered: