File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 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 = {
2727const transpiler = new tstl . Transpiler ( { emitHost } ) ;
2828
2929export class CustomTypeScriptWorker extends TypeScriptWorker {
30+ private lastResult ?: { diagnostics : readonly ts . Diagnostic [ ] ; ast : tstl . File ; lua : string ; sourceMap : string } ;
31+
3032 public async getTranspileOutput ( fileName : string ) {
3133 const { ast, lua, sourceMap } = this . transpileLua ( fileName ) ;
3234 return { ast, lua, sourceMap } ;
3335 }
3436
3537 public async getSemanticDiagnostics ( fileName : string ) {
3638 const diagnostics = await super . getSemanticDiagnostics ( fileName ) ;
37- const { diagnostics : transpileDiagnostics } = this . transpileLua ( fileName ) ;
39+ const { diagnostics : transpileDiagnostics } = this . lastResult ?? this . transpileLua ( fileName ) ;
3840 return [
3941 ...diagnostics ,
4042 ...TypeScriptWorker . clearFiles ( transpileDiagnostics . map ( ( diag ) => ( { ...diag , code : diag . source as any } ) ) ) ,
@@ -79,7 +81,8 @@ export class CustomTypeScriptWorker extends TypeScriptWorker {
7981 ] ,
8082 } ) ;
8183
82- return { diagnostics, ast, lua, sourceMap } ;
84+ this . lastResult = { diagnostics, ast, lua, sourceMap } ;
85+ return this . lastResult ;
8386 }
8487}
8588
You can’t perform that action at this time.
0 commit comments