Home > OS >  Ignore a directory In PyCharm "Find In FIles" search results
Ignore a directory In PyCharm "Find In FIles" search results

Time:08-25

My question is the same as the one posed here:

enter image description here

Here, what I want is for the first four files shown here to show up but not the remaining eight. Can anyone tell me how to get Excluded files to not show up at all in a Jetbrains Find in Files result window rather than just hilighting them differently? TIA.

CodePudding user response:

You are searching while specifying the Directory. In this "mode" the IDE will search in ALL subfolders of that folder.

If you switch the selector to the In Project for example, it then will take Excluded folders into an account.


Now, the question you have linked. That solution works for sure.

As I understand you want to limit your search to one of the folders in your project while ignoring Excluded folders that are in that folder. If that's the case then you will have to use custom scope here.

  • You create enter image description here

    CodePudding user response:

    I sent off a tech support request to Jetbrains. They got back to me in less than 24 hours (I've always had great response times from them). Here's what they said:

    Your understanding is correct -- the excluded directories should not appear in the search result. However, if you just marked the directory as excluded, it may require a project refresh to update the indices. This is done when you reopen the project.

    If the issue is still reproduced after reopening a project, there may be an issue with indices, so please try File | Invalidate Caches... | (Check all boxes) Invalidate and Restart.

    If that doesn't help as well, please check if the issue is reproduced in a new empty project with a minimal structure to reproduce the issue.

    I had already tried reloading my project, then restarting PyCharm, and even rebooting my Mac. None of those things helped. I had thought to rebuild the indexes, but I've got a number of large projects and was concerned that I'd keep hitting delays every time I opened one of them if I cleared out all of PyCharm's caches. But that was about all I had left to try, and since Jetbrains told me to try that, I did.

    ...and...clearing all PyCharm caches fixed the problem! I no longer see any of the files in Excluded directories when using any of the search modes in the "Find In Files" dialog. To be quite sure that the re-indexing fixed this, before clearing the PyCharm caches, I made a point of closing everything, then opening just the one project I was having trouble with, and then doing a straightforward search. I saw files from Excluded dirs that shouldn't have been there. Then I cleared all the PyCharm caches, and quit and restarted PyCharm. Then I did the exact same search I had done just a few minutes earlier (it took about 5 minutes to re-index the project). The results this time were to only show me what I expected/wanted. The files in Excluded directories were gone from the search results.

  • Related