-
Notifications
You must be signed in to change notification settings - Fork 13k
Description
π Search Terms
"occurrences highlighting", "angular"
π Version & Regression Information
- I believe this was a regression that occurred at some point after fix(43292): Template string literals now participate in occurrences highlightingΒ #46531 was merged in
β― Playground Link
No response
π» Code
You can see this with the basic Angular demo:
import {Component} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {bootstrapApplication} from '@angular/platform-browser';
@Component({
selector: 'app-root',
template: `
<label for="name">Name:</label>
<input type="text" id="name" [(ngModel)]="name" placeholder="Enter a name here" />
<hr />
<h1>Hello {{ name }}!</h1>
`,
imports: [FormsModule],
})
export class Demo {
name = '';
}
bootstrapApplication(Demo);

π Actual behavior
When you click on the template (with or without Angular Language Service being enabled), despite it being a multi-line template literal (marked as html
by ALS if enabled), the occurrences highlighting causes the entire string to be highlighted.
π Expected behavior
The string would not be highlighted entirely, and occurrences highlighting would work as expected for other languages embedded in template literal strings.
You can fix this by disabling Editor: Occurrences Highlight
in the settings, but then you miss out on occurrences highlighting.
Additional information about the issue
I believe at one point this was fixed in #46531
But as is pointed out in an issue on the Angular repo, it seems like the test covering this case has been changed: angular/vscode-ng-language-service#2078 (comment)