Filtering files in attached directory by extension
已回答
We have .sql files scattered throughout a large directory tree that mostly contains source code for other languages. When I attach the root of this directory and try to search for references, it takes a long time - possibly because DataGrip is scanning all the files, and not just the .sql files.
Is it possible for me to specify a filter to the attached directory so that only the .sql files are considered?
请先登录再写评论。
I created a feature request https://youtrack.jetbrains.com/issue/DBE-7029 based on your description.
Looks like a Settings | File Types | Ignored files and folders shall help with indexing performance.
The other feature is called "Scopes". Add a new one as on the pic, and switch Files view to that scope. It can be later used for searches and other actions.
Also https://www.jetbrains.com/help/datagrip/settings-scopes.html and
https://www.jetbrains.com/help/idea/configuring-scopes-and-file-colors.html
It seems like Scopes did what I needed. I'm new to DataGrip, but I had tried them previously. I didn't - and still don't - understand them completely, even after rereading the documentation.
Reverse engineering the behaviour in the application, it appears that, if I delete all my scopes, the attached directories become some kind of default scope that include all files of all types (hence the performance problem). However, if I manually create a scope, those default scopes disappear and are replaced by the one that I created. I'm not sure how the "find references" tool determines which scopes to search, but now it appears to only search the scope that I manually created, and not the default ones.
Anyway, the end result is that creating a scope solved my problem, so thanks!
Switch Scopes in Project View:
Switch Scopes in Find References (Ctrl/Cmd-Alt-Shift-F7) or "Settings" button in "Find" tool window:
"Find in Path" (Ctrl-Shift-F) also has "Scopes" chooser.
Thanks, Gregory. I've now found the various ways to configure search scopes.
However, I wasn't able to find a "project view" anywhere in DataGrip.
It is called "Files" in DataGrip.