@@ -654,5 +654,63 @@ namespace ts.projectSystem {
654654 } ) ;
655655 assert . deepEqual < readonly protocol . FileCodeEdits [ ] > ( response , [ ] ) ; // Should not change anything
656656 } ) ;
657+
658+ it ( "does not jump to source if inlined sources" , ( ) => {
659+ const aDtsInlinedSources : RawSourceMap = {
660+ ...aDtsMapContent ,
661+ sourcesContent : [ aTs . content ]
662+ } ;
663+ const aDtsMapInlinedSources : File = {
664+ path : aDtsMap . path ,
665+ content : JSON . stringify ( aDtsInlinedSources )
666+ } ;
667+ const host = createServerHost ( [ aTs , aDtsMapInlinedSources , aDts , bTs , bDtsMap , bDts , userTs , dummyFile ] ) ;
668+ const session = createSession ( host ) ;
669+
670+ openFilesForSession ( [ userTs ] , session ) ;
671+ const service = session . getProjectService ( ) ;
672+ // If config file then userConfig project and bConfig project since it is referenced
673+ checkNumberOfProjects ( service , { inferredProjects : 1 } ) ;
674+
675+ // Inlined so does not jump to aTs
676+ assert . deepEqual (
677+ executeSessionRequest < protocol . DefinitionAndBoundSpanRequest , protocol . DefinitionAndBoundSpanResponse > (
678+ session ,
679+ protocol . CommandTypes . DefinitionAndBoundSpan ,
680+ protocolFileLocationFromSubstring ( userTs , "fnA()" )
681+ ) ,
682+ {
683+ textSpan : protocolTextSpanFromSubstring ( userTs . content , "fnA" ) ,
684+ definitions : [
685+ protocolFileSpanWithContextFromSubstring ( {
686+ file : aDts ,
687+ text : "fnA" ,
688+ contextText : "export declare function fnA(): void;"
689+ } )
690+ ] ,
691+ }
692+ ) ;
693+
694+ // Not inlined, jumps to bTs
695+ assert . deepEqual (
696+ executeSessionRequest < protocol . DefinitionAndBoundSpanRequest , protocol . DefinitionAndBoundSpanResponse > (
697+ session ,
698+ protocol . CommandTypes . DefinitionAndBoundSpan ,
699+ protocolFileLocationFromSubstring ( userTs , "fnB()" )
700+ ) ,
701+ {
702+ textSpan : protocolTextSpanFromSubstring ( userTs . content , "fnB" ) ,
703+ definitions : [
704+ protocolFileSpanWithContextFromSubstring ( {
705+ file : bTs ,
706+ text : "fnB" ,
707+ contextText : "export function fnB() {}"
708+ } )
709+ ] ,
710+ }
711+ ) ;
712+
713+ verifySingleInferredProject ( session ) ;
714+ } ) ;
657715 } ) ;
658716}
0 commit comments