已合并
fix: skip oh_modules folder #39
fix: skip oh_modules folder #39
已合并
Cangjie-天天创建于 25 天前
共 1 个文件变更+8-0
@@ -67,6 +67,8 @@ public class CangjieFileListener extends VFSListener {
67 67 
68 private static final Set<String> FILE_EXTENSIONS = Set.of(LanguageManager.CANGJIE_EXTENSION);68 private static final Set<String> FILE_EXTENSIONS = Set.of(LanguageManager.CANGJIE_EXTENSION);
69 69 
70+ private static final Set<String> SKIP_DIRECTORIES = Set.of("oh_modules", "node_modules", ".idea", "build");
71+ 
70 /**72 /**
71 * Fired when a virtual file is renamed from within IDEA, or its writable status is changed.73 * Fired when a virtual file is renamed from within IDEA, or its writable status is changed.
72 * For files renamed externally, {@link #fileCreated} and {@link #fileDeleted} events will be fired.74 * For files renamed externally, {@link #fileCreated} and {@link #fileDeleted} events will be fired.
@@ -163,10 +165,16 @@ public class CangjieFileListener extends VFSListener {
163 165 
164 private void beforeDirectoryDeletion(@NotNull VirtualFileEvent event) {166 private void beforeDirectoryDeletion(@NotNull VirtualFileEvent event) {
165 VirtualFile file = event.getFile();167 VirtualFile file = event.getFile();
168+ if (SKIP_DIRECTORIES.contains(file.getName())) {
169+ return;
170+ }
166 Project project = getProject(event, file);171 Project project = getProject(event, file);
167 VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor<Void>() {172 VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor<Void>() {
168 @Override173 @Override
169 public boolean visitFile(@NotNull VirtualFile f) {174 public boolean visitFile(@NotNull VirtualFile f) {
175+ if (f.isDirectory() && SKIP_DIRECTORIES.contains(f.getName())) {
176+ return false;
177+ }
170 if (!f.isDirectory() && isCangjieFile(f)) {178 if (!f.isDirectory() && isCangjieFile(f)) {
171 if (Objects.nonNull(project)) {179 if (Objects.nonNull(project)) {
172 project.getMessageBus()180 project.getMessageBus()