File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4743,6 +4743,19 @@ namespace ts {
47434743 || kind === SyntaxKind . TemplateTail ;
47444744 }
47454745
4746+ export function isStringTextContainingNode ( node : Node ) {
4747+ switch ( node . kind ) {
4748+ case SyntaxKind . StringLiteral :
4749+ case SyntaxKind . TemplateHead :
4750+ case SyntaxKind . TemplateMiddle :
4751+ case SyntaxKind . TemplateTail :
4752+ case SyntaxKind . NoSubstitutionTemplateLiteral :
4753+ return true ;
4754+ default :
4755+ return false ;
4756+ }
4757+ }
4758+
47464759 // Identifiers
47474760
47484761 /* @internal */
Original file line number Diff line number Diff line change @@ -787,7 +787,7 @@ namespace ts {
787787
788788 export function isInString ( sourceFile : SourceFile , position : number ) : boolean {
789789 const previousToken = findPrecedingToken ( position , sourceFile ) ;
790- if ( previousToken && previousToken . kind === SyntaxKind . StringLiteral ) {
790+ if ( previousToken && isStringTextContainingNode ( previousToken ) ) {
791791 const start = previousToken . getStart ( ) ;
792792 const end = previousToken . getEnd ( ) ;
793793
Original file line number Diff line number Diff line change 22
33///////<reference path="./Bar.ts" />
44
5- ////function /**/ [|Bar|]() {
5+ ////function [|Bar|]() {
66//// // This is a reference to [|Bar|] in a comment.
7- //// "this is a reference to [|Bar|] in a string"
7+ //// "this is a reference to [|Bar|] in a string";
8+ //// `Foo [|Bar|] Baz.`;
9+ //// {
10+ //// const Bar = 0;
11+ //// `[|Bar|] ba ${Bar} bara [|Bar|] berbobo ${Bar} araura [|Bar|] ara!`;
12+ //// }
813//// }
914
1015const ranges = test . ranges ( ) ;
You can’t perform that action at this time.
0 commit comments