angular / vscode-ng-language-service

Angular extension for Visual Studio Code
MIT License
773 stars 116 forks source link

Control Flow syntax highlight curly braces mismatch #1991

Open ryanhanwu opened 7 months ago

ryanhanwu commented 7 months ago

🐞 bug report

Is this a regression?

Don't think so, the Control Flow syntax is new.

Description

When using the Control Flow syntax, the curly braces breaks the syntaxhighlight.

Bug Type

What does this bug affect

Reproduction

Expected behavior

The curly braces should be correctly highlighted.

Screenshots

Screenshot 2024-01-23 at 9 25 40 AM

🌍 Your Environment

Angular Version: N/A

Extension Version:


v17.1.0

VSCode Version:


1.85.1

Operating System:


Mac OS 14.2.1

Extension options:


Default

Thanks!

kimdah3 commented 5 months ago

Same behaviour with a one-liner

@if (true) {{{ variable }}}

image

Adding spaces doesn't show any error and makes more sense

@if (true) { {{ variable }} }

image Maybe tripple curly brackets (even though it's not especially readable) coming after the new control flow shouldn't show up as red at all?

atscott commented 5 months ago

Maybe tripple curly brackets (even though it's not especially readable) coming after the new control flow shouldn't show up as red at all?

It's not that triple curly is intentionally red. It's that {{ is immediately captured as a binding, the first }} is then the end of the binding and then the extra { and } are mismatched. Texmate scopes work off of regex capturing so the solution isn't necessarily simple.