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

[Feature request] Highlighting within inline templates #2078

Open
1 of 2 tasks
christophbuehler opened this issue Aug 11, 2024 · 4 comments
Open
1 of 2 tasks

[Feature request] Highlighting within inline templates #2078

christophbuehler opened this issue Aug 11, 2024 · 4 comments
Labels

Comments

@christophbuehler
Copy link

🚀 feature request

Description

When the cursor is placed on any tag within an inline template, the entire template is highlighted. In external HTML templates, just the opening and the closing tag are highlighted. I assume this is the case because the language mode of the file is set to TypeScript, not HTML. I find this very annoying.

Feature Type

What does this bug affect

  • Angular Language Service VSCode extension
  • Angular Language Service server

Describe the solution you'd like

Ideally the language mode of inline templates would be set to HTML.

Describe alternatives you've considered

Have you considered any alternative solutions or workarounds?

I have tried using other extensions, like Inline HTML that should change the language mode of template strings with moderate success.

Anything else relevant?

How it is:
image
What I would expect:
image

@urielzen
Copy link

urielzen commented Feb 9, 2025

As a temporary workaround you can set the following in your settings.json

"workbench.colorCustomizations": {
    "editor.wordHighlightBackground": "#ffffff00",
    "minimap.selectionOccurrenceHighlight": "#ffffff00"
}

@jreidgreer
Copy link

This drives me insane, makes inline templates almost unusable.

You can sorta get around this by disabling Editor: Occurrences Highlight in the settings. The downside is that you miss out on occurrences highlighting (clicking on a symbol and seeing other instances of it highlighted).

It looks like this was actually a previous problem that was fixed at some point: microsoft/vscode#185267
microsoft/TypeScript#46531

So it's possible this is a TypeScript issue and not Angular.

@atscott
Copy link
Collaborator

atscott commented Feb 27, 2025

This does seem like its due to the Occurrences Highlight feature. The language service already switches the language inside the template string to html and isn't actively providing a highlight for the whole string. It does seem like there's a potential regression in VSCode. The test added in microsoft/TypeScript#46531 to verify the multiline template string didn't highlight is now verifying baseline highlights at head

@jreidgreer
Copy link

Appreciate you looking into this @atscott! I'll go ahead and open an issue in the TypeScript repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants