Skip to content

Commit

Permalink
fix: prevent IJ from reporting an error when config file is deleted
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Bricon <[email protected]>
  • Loading branch information
fbricon committed Apr 30, 2024
1 parent 25ce1d6 commit 2aa4166
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,13 @@ public void evictConfigSourcesCache(VirtualFile file) {
if (existingConfigSource != null) {
// The config source file exists, update / delete it from the cache
boolean updated = ReadAction.compute(() -> {
PsiFile psiFile = PsiManager.getInstance(javaProject.getProject()).findFile(file);
if (psiFile != null) {
// The config source file has been updated, reload it
existingConfigSource.reload(psiFile);
return true;
if (file.isValid()) {
PsiFile psiFile = PsiManager.getInstance(javaProject.getProject()).findFile(file);
if (psiFile != null) {
// The config source file has been updated, reload it
existingConfigSource.reload(psiFile);
return true;
}
}
// The config source file has been deleted, remove it
return false;
Expand Down

0 comments on commit 2aa4166

Please sign in to comment.