Exclude directory from Go To Declaration

Is it possible to exclude a directory from the Go To Declaration functionality but keep it included for search, version control integration and other functions? It's convenient for me to keep two extra branches of my code in my project so I can easily merge changes from my main branch using JetBrains' fabulous compare tool. I also use the "jump to declaration" function a lot, but I find it distracting to always see three possible versions of a declaration, when I only ever need to work with one. Is there any way to configure this without excluding the other directories from the project?



Hi there,

You cannot, unless such file(s) will be marked as plain text (which I do not think you want to do,since it has to be done for each file manually).

I may only suggest to have different project for another branch .. and if you need to do your specific (I guess) comparison/merging, just add another branch folder as Additional Content Root (Settings | Directories) when required (or .. keep as is, just mark other branches as Excluded folders .. and un-exclude them when needed).


Thanks Andriy, I'll try that.

What would make this situation easier would be if you could unexclude directories from the context menu in the project tree - the option to exclude is very handy, but there's no corresponding option to reverse the process. This could be done from the project root, or from the directory that contains an excluded directory. Or you could still show excluded directories, but grey them out, allowing the user to right-click on them for the unexclude option.


Please sign in to leave a comment.