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

Syntax highlighting is broken for handlebars comments #168179

Closed
tonyobanon opened this issue Dec 6, 2022 · 2 comments
Closed

Syntax highlighting is broken for handlebars comments #168179

tonyobanon opened this issue Dec 6, 2022 · 2 comments
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@tonyobanon
Copy link

tonyobanon commented Dec 6, 2022

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

  • VS Code Version: 1.73.1
  • OS Version: Darwin x64 21.6.0

Steps to Reproduce:

  1. Create a file called helloworld.hbs and paste this there: {{!-- outer comment {{!-- inner comment --}} {{hello --}}
    Below is what you see on the screen.
    index view — project_panther_fe 2022-12-06 16-34-05

  2. Visit https://handlebarsjs.com/playground.html and in the template section, also paste the above string. Then open your browser console, you will notice compile errors.
    Below is what you see on the screen.
    Handlebars 2022-12-06 16-31-51

According to the the handlebars parser (also as you can see in the handlebars playground as well), the first "--}}" encountered terminates the comment. But VS Code tricks the developer into thinking that the comment is only terminated after the last "--}}". This will lead to errors and a poor experience

@RedCMD
Copy link
Contributor

RedCMD commented Dec 6, 2022

Looking at the syntax highlighter code
it does seem intentional
https://github.com/daaain/Handlebars/blob/c2c09947b6b83d740e9ee94a6e3a0199476f2e15/grammars/Handlebars.json#L365

@alexr00
Copy link
Member

alexr00 commented Dec 7, 2022

Moved to upstream repo: textmate/html.tmbundle#123

It looks like there haven't been changes then in quite a while though. We might consider changing to a different handlebars grammar.

@alexr00 alexr00 added grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream labels Dec 7, 2022
@alexr00 alexr00 closed this as completed Dec 7, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

4 participants