-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Attribute values containing ${} anywhere are interpreted as javascript with fixed offsets #57
Comments
Just FYI, this won't be solved here - you could create a grammar for thymeleaf to then be injected here |
I am not sure this issue is thymeleaf specific though. If the HTML grammar already looks for these interpolation constructs in attributes, it should also consider where in the attribute they appear. This is independent of thymeleaf. |
No, the HTML grammar does not look for them. The way it works is an injections query is created to inject languages into certain nodes of the HTML grammar - in Neovim JavaScript is injected if $( and } are present iirc. Same construct would apply for thymeleaf, once there's a grammar certain patterns/nodes can be queried to have that language injected. |
Alright. But since there is no thymeleaf grammar as far as I know, this would then mean that the JavaScript grammar is wrong here, correct? |
To bring this a bit further, I get that the HTML grammar injects Javascript here. This already seems like a fairly strong assumption that's not always correct. But wouldn't it be better if the condition for the injection and the injection offsets would at least match in their positions? The current result just looks weird. |
This is particularly noticeable when using thymeleaf expression syntax.
For example I have this element:
The attribute value starting from the second "o" until the last "e" is interpreted as javascript. This looks to me as if the dollar sign, opening and closing brace are implicitly assumed to be at the start and end of the attribute value, even though they can appear anywhere in the attribute to trigger this behavior.
Here is what that looks like when using this for highlighting in neovim:
This is what the TSPlayground shows when toggling everything on:
The text was updated successfully, but these errors were encountered: