16
16
import java .util .HashMap ;
17
17
import java .util .List ;
18
18
import java .util .Map ;
19
+ import java .util .concurrent .ExecutionException ;
19
20
import java .util .concurrent .TimeUnit ;
20
21
21
22
import org .eclipse .core .resources .IFile ;
27
28
import org .eclipse .jface .text .IDocument ;
28
29
29
30
import ts .TypeScriptException ;
31
+ import ts .TypeScriptNoContentAvailableException ;
30
32
import ts .client .ITypeScriptServiceClient ;
31
33
import ts .client .compileonsave .CompileOnSaveAffectedFileListSingleProject ;
32
34
import ts .client .diagnostics .DiagnosticEventBody ;
@@ -286,12 +288,10 @@ public boolean isInScope(IResource resource) {
286
288
}
287
289
288
290
/**
289
- * Returns true if the given js, jsx file can be validated and false
290
- * otherwise.
291
+ * Returns true if the given js, jsx file can be validated and false otherwise.
291
292
*
292
293
* @param file
293
- * @return true if the given js, jsx file can be validated and false
294
- * otherwise.
294
+ * @return true if the given js, jsx file can be validated and false otherwise.
295
295
* @throws CoreException
296
296
*/
297
297
private boolean isJsFileIsInScope (IFile file , ITsconfigBuildPath tsContainer ) throws CoreException {
@@ -316,12 +316,10 @@ private boolean isJsFileIsInScope(IFile file, ITsconfigBuildPath tsContainer) th
316
316
}
317
317
318
318
/**
319
- * Returns true if the given ts, tsx file can be validated and false
320
- * otherwise.
319
+ * Returns true if the given ts, tsx file can be validated and false otherwise.
321
320
*
322
321
* @param file
323
- * @return true if the given ts, tsx file can be validated and false
324
- * otherwise.
322
+ * @return true if the given ts, tsx file can be validated and false otherwise.
325
323
* @throws CoreException
326
324
*/
327
325
private boolean isTsFileIsInScope (IFile file , ITsconfigBuildPath tsContainer ) throws CoreException {
@@ -466,7 +464,16 @@ private boolean compileTsFiles(List<String> tsFilesToCompile, ITypeScriptService
466
464
if (monitor .isCanceled ()) {
467
465
return true ;
468
466
}
469
- compileTsFile (filename , client );
467
+ try {
468
+ compileTsFile (filename , client );
469
+ } catch (ExecutionException e ) {
470
+ if (e .getCause () instanceof TypeScriptNoContentAvailableException ) {
471
+ // Ignore "No content available" error.
472
+ }
473
+ else {
474
+ throw e ;
475
+ }
476
+ }
470
477
}
471
478
return false ;
472
479
}
0 commit comments