File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,16 @@ const emitHost: tstl.EmitHost = {
27
27
const transpiler = new tstl . Transpiler ( { emitHost } ) ;
28
28
29
29
export class CustomTypeScriptWorker extends TypeScriptWorker {
30
+ private lastResult ?: { diagnostics : readonly ts . Diagnostic [ ] ; ast : tstl . File ; lua : string ; sourceMap : string } ;
31
+
30
32
public async getTranspileOutput ( fileName : string ) {
31
33
const { ast, lua, sourceMap } = this . transpileLua ( fileName ) ;
32
34
return { ast, lua, sourceMap } ;
33
35
}
34
36
35
37
public async getSemanticDiagnostics ( fileName : string ) {
36
38
const diagnostics = await super . getSemanticDiagnostics ( fileName ) ;
37
- const { diagnostics : transpileDiagnostics } = this . transpileLua ( fileName ) ;
39
+ const { diagnostics : transpileDiagnostics } = this . lastResult ?? this . transpileLua ( fileName ) ;
38
40
return [
39
41
...diagnostics ,
40
42
...TypeScriptWorker . clearFiles ( transpileDiagnostics . map ( ( diag ) => ( { ...diag , code : diag . source as any } ) ) ) ,
@@ -79,7 +81,8 @@ export class CustomTypeScriptWorker extends TypeScriptWorker {
79
81
] ,
80
82
} ) ;
81
83
82
- return { diagnostics, ast, lua, sourceMap } ;
84
+ this . lastResult = { diagnostics, ast, lua, sourceMap } ;
85
+ return this . lastResult ;
83
86
}
84
87
}
85
88
You can’t perform that action at this time.
0 commit comments