@@ -45,6 +45,15 @@ export default class GlintLanguageService implements Partial<ts.LanguageService>
45
45
}
46
46
}
47
47
48
+ private getTransformInfoForPath ( path : string ) : TransformInfo | undefined {
49
+ let originalPath = isTransformablePath ( path ) ? path : getOriginalPath ( path as TransformedPath ) ;
50
+ let transformedPath = isTransformedPath ( path )
51
+ ? path
52
+ : getTransformedPath ( path as TransformablePath ) ;
53
+
54
+ return this . getTransformInfo ( originalPath , transformedPath ) ;
55
+ }
56
+
48
57
private getTransformInfo (
49
58
originalPath : TransformablePath ,
50
59
transformedPath : TransformedPath
@@ -80,7 +89,7 @@ export default class GlintLanguageService implements Partial<ts.LanguageService>
80
89
if ( info ) {
81
90
return this . ls
82
91
. getSemanticDiagnostics ( info . transformedPath )
83
- . map ( ( diagnostic ) => rewriteDiagnostic ( this . ts , diagnostic , info . transformedModule ) ) ;
92
+ . map ( ( diagnostic ) => this . rewriteDiagnostic ( diagnostic ) ) ;
84
93
}
85
94
86
95
return this . ls . getSemanticDiagnostics ( fileName ) ;
@@ -91,12 +100,20 @@ export default class GlintLanguageService implements Partial<ts.LanguageService>
91
100
if ( info ) {
92
101
return this . ls
93
102
. getSuggestionDiagnostics ( info . transformedPath )
94
- . map ( ( diagnostic ) => rewriteDiagnostic ( this . ts , diagnostic , info . transformedModule ) ) ;
103
+ . map ( ( diagnostic ) => this . rewriteDiagnostic ( diagnostic ) ) ;
95
104
}
96
105
97
106
return this . ls . getSuggestionDiagnostics ( fileName ) ;
98
107
}
99
108
109
+ private rewriteDiagnostic < T extends ts . Diagnostic > ( diagnostic : T ) : T {
110
+ return rewriteDiagnostic (
111
+ this . ts ,
112
+ diagnostic ,
113
+ ( fileName ) => this . getTransformInfoForPath ( fileName ) ?. transformedModule
114
+ ) ;
115
+ }
116
+
100
117
public getEncodedSyntacticClassifications (
101
118
fileName : string ,
102
119
span : ts . TextSpan
0 commit comments