mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
fix(43292): forbid highlighting multiline template strings (#46531)
This commit is contained in:
@@ -2021,7 +2021,8 @@ namespace ts.FindAllReferences {
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nodeEntry(ref, EntryKind.StringLiteral);
|
||||
return isNoSubstitutionTemplateLiteral(ref) && !rangeIsOnSingleLine(ref, sourceFile) ? undefined :
|
||||
nodeEntry(ref, EntryKind.StringLiteral);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////const foo = `
|
||||
//// a
|
||||
//// [|b|]
|
||||
//// c
|
||||
////`
|
||||
|
||||
const [r] = test.ranges();
|
||||
verify.noDocumentHighlights(r);
|
||||
18
tests/cases/fourslash/documentHighlightTemplateStrings.ts
Normal file
18
tests/cases/fourslash/documentHighlightTemplateStrings.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////type Foo = "[|a|]" | "b";
|
||||
////
|
||||
////class C {
|
||||
//// p: Foo = `[|a|]`;
|
||||
//// m() {
|
||||
//// switch (this.p) {
|
||||
//// case `[|a|]`:
|
||||
//// return 1;
|
||||
//// case "b":
|
||||
//// return 2;
|
||||
//// }
|
||||
//// }
|
||||
////}
|
||||
|
||||
const [r0, r1, r2] = test.ranges();
|
||||
verify.documentHighlightsOf(r2, [r0, r1, r2]);
|
||||
Reference in New Issue
Block a user