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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: HTML comments not properly highlighted in ternary expressions #271

Open
markmals opened this issue May 5, 2022 · 1 comment 路 May be fixed by #828
Open

馃悰 BUG: HTML comments not properly highlighted in ternary expressions #271

markmals opened this issue May 5, 2022 · 1 comment 路 May be fixed by #828
Labels
- P2: nice to have Not breaking anything but nice to have (priority) feat: syntax Issue in our syntax highlighting (scope)

Comments

@markmals
Copy link

markmals commented May 5, 2022

Describe the Bug

When using an HTML comment as one of the results of an inline ternary expression in an Astro template file, Visual Studio Code with the Astro extension (version: 0.16.1) does not properly highlight it as a comment and instead highlights it as what appears to be invalid JSX. Image attached:

Screen Shot 2022-05-05 at 12 32 55 PM

Steps to Reproduce

  1. Install the Astro extension (version: 0.16.1) for Visual Studio Code.
  2. Open or create an Astro template file (.astro) in Visual Studio Code.
  3. Write a ternary expression in the template file where one of the results is an HTML comment, for example:
---
const sayHello = false
---

{ sayHello ? <h1>Hello, World!<h1> : <!-- Goodbye, World. --> }
  1. Observe how Visual Studio Code doesn't correctly highlight the HTML comment (<!-- Goodbye, World. -->) as a comment.
@Princesseuh Princesseuh added the feat: syntax Issue in our syntax highlighting (scope) label May 5, 2022
@Princesseuh
Copy link
Member

This happens because we treat those context as JSX syntax (which can't have HTML comments) instead of HTML. I wonder if we'd be able to add HTML comments to the JSX syntax for this use case 馃

Good catch, thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority) feat: syntax Issue in our syntax highlighting (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants