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

Improve syntax highlighting and handling #9

Open
adrianocr opened this issue Nov 16, 2017 · 2 comments
Open

Improve syntax highlighting and handling #9

adrianocr opened this issue Nov 16, 2017 · 2 comments

Comments

@adrianocr
Copy link

adrianocr commented Nov 16, 2017

I'm interested in helping improve the syntax highlighting and handling but I am not sure where to start yet. Any resources on the .tmLanguage file or vscode syntax highlighting you recommend?

Namely I think we should introduce better javascript <script> tag handling in the syntax highlighting. As of now if you have {{ variable }} inside of objects if often reads it as an error and the highlighting gets all messed up from that point on until you close the </script> block.

Additionally it'd be awesome if we could handle the new {% stylesheet %} {% endstylesheet %} blocks as a <style></style> block and the new {% javascript %} {% endjavascript %} block as a <script></script> block.

And lastly handling for {% schema %} {% endschema %} blocks as Javascript/JSON.

Those are all pretty much Section (https://help.shopify.com/themes/development/theme-editor/sections) related.

@turansadri
Copy link

These all would be excellent and also it would be nice to have highlighting for liquid tags which are used inside strings. For example in this case <div class="someclass {{ moreclasses }}"></div> the {{ }} tags are not highlighted.

@benzittlau
Copy link

I ran into the issue @turansadri is describing here while working in Jekyll. It's a very common thing to have some conditional logic inside an HTML tag in that use case (in particular for controlling styling), so having the syntax highlighting for liquid break in that case is pretty impactful.

Here's an example piece of code that sees this issue:

{% if page.url == "/" %}style="color: red;"{% endif %}>
<nav>
  <a href="/" {% if page.url == "/" %}style="color: red;"{% endif %}>

What it appears as in VSCode with the current version of this extension. Note that the first usage is highlighted correctly, but the syntax highlighting on the exact same code is broken inside the html tag:
image

Liquid Language Support: 0.1.1
VSCode: 1.32.3

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

3 participants