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

[html] Error when using handlebars in style attribute #67871

Closed
tomires opened this issue Feb 4, 2019 · 2 comments
Closed

[html] Error when using handlebars in style attribute #67871

tomires opened this issue Feb 4, 2019 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug html HTML support issues
Milestone

Comments

@tomires
Copy link

tomires commented Feb 4, 2019

  • VSCode Version: 1.30.2
  • OS Version: Linux x64 4.15.0-43-generic

Using handlebars in style attribute causes VS Code to report an error.

Steps to Reproduce:

  1. Create a new HTML file
  2. Paste the following snippet:
    <input type="text" name="user_name" placeholder="Enter user name" class="textbox_with_icon" style="background-image: url({{ url_for('static', filename='images/icon_user_gray.svg') }});">
  3. VS Code now shows an error

image

Does this issue occur when all extensions are disabled?: Yes

I believe it is the same issue as #53314 , however that issue has been closed due to apparent lack of reproducibility (however the original snippet does too throw an error on my setup).

@octref octref added css-less-scss Issues and items concerning CSS,Less,SCSS styling html HTML support issues bug Issue identified by VS Code Team member as probable bug labels Feb 4, 2019
@octref octref added this to the Backlog milestone Feb 4, 2019
@aeschli aeschli changed the title Error when using handlebars in style attribute (HTML) [html] Error when using handlebars in style attribute Feb 21, 2020
@aeschli aeschli removed the css-less-scss Issues and items concerning CSS,Less,SCSS styling label Feb 21, 2020
@ntotten
Copy link

ntotten commented Apr 24, 2020

I would propose that some sort of setting be added to the language server that allows identifying template characters. For example, if we could specify template characters similar to how we specify folding characters in a custom language - although in this case its not applying to a custom language, but rather to a set of HTML files - we could simply tell the HTML language server (and sub-languages for JS and CSS) to not validate those strings.

This is a simplification but if we could provide something like this to tell the language server which files this applies to and what the templating patterns are, this would allow eliminating these errors.

  "templating": {
    "paths": [
       "**/lwc/*.html"
    ],
    "matches": [
        "(\"|'|=){#(.+)}",
        "(\"|'|=){{(.+)}}"
     ]
  }

There is certainly more we could do in terms of extending the HTML language server to provide code completion and validation for these types of templates, but I think this is a good-enough solution to start.

@aeschli
Copy link
Contributor

aeschli commented Nov 13, 2020

#49210 is the issue to make the HTML support either configurable to it knows about template languages, or make it easy to create a template language server by parameterizing the HTML language support.

@aeschli aeschli closed this as completed Nov 13, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug html HTML support issues
Projects
None yet
Development

No branches or pull requests

4 participants