Skip to content

Commit f43ada8

Browse files
committed
Moving file type checking to the background (#1974)
1 parent a8104dd commit f43ada8

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This document provides a high-level view of the changes introduced by release.
99

1010
=== 0.45.3
1111

12-
...
12+
- Moving file type checking to the background (#1974)
1313

1414
=== 0.45.2
1515

src/main/java/org/asciidoc/intellij/psi/search/AsciiDocLinkProjectOpen.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,30 @@ public void runActivity(@NotNull Project project) {
3737
public void after(@NotNull List<? extends VFileEvent> events) {
3838
// any modification of a file within the project refreshes the preview
3939
Set<String> canonicalPaths = new HashSet<>();
40-
for (VFileEvent event : events) {
41-
if (event.getFile() != null) {
42-
if (!project.isDisposed()) {
43-
VirtualFile file = event.getFile();
44-
if (!file.isValid()) {
45-
continue;
46-
}
47-
if (!file.getFileType().equals(AsciiDocFileType.INSTANCE)) {
48-
continue;
49-
}
50-
if (!DumbService.isDumb(project)) {
51-
String canonicalPath = file.getCanonicalPath();
52-
if (canonicalPath != null) {
53-
canonicalPaths.add(canonicalPath);
40+
ApplicationManager.getApplication().executeOnPooledThread(() -> {
41+
for (VFileEvent event : events) {
42+
if (event.getFile() != null) {
43+
if (!project.isDisposed()) {
44+
VirtualFile file = event.getFile();
45+
if (!file.isValid()) {
46+
continue;
47+
}
48+
if (!file.getFileType().equals(AsciiDocFileType.INSTANCE)) {
49+
continue;
50+
}
51+
if (!DumbService.isDumb(project)) {
52+
String canonicalPath = file.getCanonicalPath();
53+
if (canonicalPath != null) {
54+
canonicalPaths.add(canonicalPath);
55+
}
5456
}
5557
}
5658
}
5759
}
58-
}
59-
if (!canonicalPaths.isEmpty()) {
60-
runInBackground(canonicalPaths, project);
61-
}
60+
if (!canonicalPaths.isEmpty()) {
61+
runInBackground(canonicalPaths, project);
62+
}
63+
});
6264
}
6365
});
6466
}

0 commit comments

Comments
 (0)