From 1428553ad59b3daa5e893dddb29d0155a3b763fa Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 30 Sep 2024 20:10:24 +0200 Subject: [PATCH] find: fix inconsistent search in project/.iml/.ipr files (IJPL-49974) GitOrigin-RevId: 8b8f5c3dc399675687e1959598b055ee83bcebda --- .../src/com/intellij/find/FindModel.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/platform/indexing-api/src/com/intellij/find/FindModel.java b/platform/indexing-api/src/com/intellij/find/FindModel.java index 21271d81653f..fe21ea0ef50d 100644 --- a/platform/indexing-api/src/com/intellij/find/FindModel.java +++ b/platform/indexing-api/src/com/intellij/find/FindModel.java @@ -563,14 +563,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable { if (changed) { this.directoryName = directoryName; notifyObservers(); - if (directoryName != null) { - String path = FileUtil.toSystemIndependentName(directoryName); - if (path.endsWith("/.idea") || path.contains("/.idea/")) { - setSearchInProjectFiles(true); - } - } } - } /** @@ -694,12 +687,6 @@ public class FindModel extends UserDataHolderBase implements Cloneable { if (changed) { this.fileFilter = fileFilter; notifyObservers(); - if (fileFilter != null) { - List split = StringUtil.split(fileFilter, ","); - if (ContainerUtil.exists(split, s -> s.endsWith("*.iml") || s.endsWith("*.ipr") || s.endsWith("*.iws"))) { - setSearchInProjectFiles(true); - } - } } } @@ -883,6 +870,20 @@ public class FindModel extends UserDataHolderBase implements Cloneable { } public boolean isSearchInProjectFiles() { + if (!mySearchInProjectFiles) { + if (fileFilter != null) { + List split = StringUtil.split(fileFilter, ","); + if (ContainerUtil.exists(split, s -> s.endsWith(".iml") || s.endsWith(".ipr") || s.endsWith(".iws"))) { + return true; + } + } + if (directoryName != null) { + String path = FileUtil.toSystemIndependentName(directoryName); + if (path.endsWith("/.idea") || path.contains("/.idea/")) { + return true; + } + } + } return mySearchInProjectFiles; }