Ignore symlinks in project (indexing, code-completion etc) Follow
Is there a feature for telling PHPStorm on a global basis to completly ignore symlinks in a project?
Either hiding them completly or just stop indexing them.
From reading various articles about this topic I already know that I can simly mark the folder as excluded. But it would be really nice, to just tell PHPStorm to stop doing this for every symlink in every project. I read about scopes but I am not sure if this can be configured that way...is there a pattern that matches only symlinks?
Please sign in to leave a comment.
There are no such options AFAIK. And such option does not make much sense in general -- what if somebody wants to keep some big shared library outside of the project and use it via symlink (think about old style projects where no composer or any other dependency management system is used (e.g. not even git)) .. or just some other helper code that is not needed beyond development environment (IDE helpers etc).
Right now only marking such folders as Excluded or marking individual files (if there few of them) as Plain Text is the real way to go. Custom scopes will not help here at all (they are not taken into consideration when doing Code Completion/Indexing)
On related note:
Well it would be easy to fix:
Did you get anywhere Michael? Symlink indexing (I think) is locking up my system and I can't work. I excluded the web directory but the indexer still goes there. I followed the advice at this link and it's still locking up. Maybe it's not even the indexer as there is no "indexing" status on the bottom status bar.
@Richard Riley I think you misunderstood. It would be easy to fix (for Jetbrains), but it's not fixed until now.
Still waiting for a feedback...
No I didn't misunderstand. Jetbrains have refused it as their issue, There is a another list on this - probably at the github for the symfony extension. Putting my PC into "low power mode" fixes it btw.
This just affected me. REALLY freaking annoying and quite frankly absurd this hasn't been resolved.
Hi yes I'd like to add my support for this:
I have a project with a number of docker containers as subprojects under the root, but they share common code using symlinks ( and docker build context ).
Every time I search, I find 10 occurrences of the code I'm looking for, and I'm constantly fighting 'background changes / load from disk' when trying to refactor anything.
Having intellJidea etc ignore symlinks for the purpose of search and refactor would be desireable
Beep We REALLY need a solution to this. I am working on a 3rd party project that has symlinks in the web subdirectory pointing to millions of files. IDEA is just freezing. It can't be that hard to turn off indexing for symlinks or directories with some sort of IGNORE directive surely (like "ignore" in the project hierarchy directory tagging)? I have set both my HUGE hierarchies to "ignore" and no dice. PLEASE fix this.
Replied in another thread
Marking them symlink directories as Excluded sounds about right to me.
Dmitry Tronin which thread?
I believe it's that one.
What issue are you experiencing exactly?
Thanks for the prompt reply.
I'm using PyCharm and a virtualenv typically creates two folders `lib` and `lib64` where `lib64` is a symbolic link to `lib`, during indexing I see that PyCharm scans both directories.
I can manually exclude one of them but I was wondering if there is anything in PyCharm that can help with this and stumbled upon this thread.
After all, there might be some sense in not indexing twice the same directory.
I see. Please open Help > Find Action and open Registry...
Then find "indexer.follows.symlinks" and disable it. You can use search-as-you-type there to find it. Check if that helps with the issue.
Thanks for the tip; I disabled the flag but `lib64` is still scanned during indexing after restarting PyCharm with 'Invalidate Cache'
Sorry that it didn't help. Seems like there's no other options atm, here are corresponding reports at our tracker: https://youtrack.jetbrains.com/issue/IDEA-127022 & https://youtrack.jetbrains.com/issue/IDEA-189247.
Probably that plugin https://plugins.jetbrains.com/plugin/16110-symlink-excluder may be helpful
Searching by "simlink" in plugin marketplace from inside PHPStorm I can see these plugins exist too:
IDEA Resolve Symlinks
Symlink Excluder (already linked above by Pavel)
Each offers similar but not identical functionality, read the description for which does best for you.
> Right now only marking such folders as Excluded [...] is the real way to go.
Fine by me, if it would actually work.
I'm developing a composer package - and one common way to do this, is to have the source code in /packages in your project, and that same path added as repository to your composer.json. This causes composer to install your package by creating a symlink to that path in your vendor folder.
All my classes are now found twice, and various refactoring options no longer work because of that. And I can exclude the symlink, the parent folder above the symlink, even the entire vendor folder - does not help. Even after invalidating the cache and re-indexing everything, the classes are still found twice - once in the /packages folder, and once via the EXCLUDED symlink.
I'd have to delete the symlink, re-index the project, do the refactor, and run composer install to re-create the symlink and make the app work again.
If it's not possible to ignore symlinks, then PLEASE at least make it so that excluding the symlink actually works!
@Michael Huber Could you please try one trick?
You may want to open the internal IDE Registry (Help > Find action > "Registry") and untick the "indexer.follows.symlinks" option and restart the IDE. Does it help?
What finally did work for me, after quite a bit of trial and error, is to exclude everything BELOW the Symlink.
It would seem that excluding works recursively through folders - but does stop at symlinks.
I can try fiddling with the Registry... I guess
Nope, that does not work.
After removing the Exclusions, removing the checkbox "indexer.follows.symlinks" and restarting the IDE the classes in the package are back to being shown twice, and refactoring options like "move method" fail with the Error "There are several classes with specified name ...".
Setting the checkbox again, adding the Exclusions again, and restarting the IDE... and move method still fails...
Oh come on... I remember that working yesterday, after I set the Exclusions like this...
Sorry, Michael, missed your comment.
Is there any chance that you have your package also added to "Settings/Preferences | PHP > Include path"?
Oh, yes, it would seem that everything in composers' vendor folder is in the include path.
I don't remember adding all that stuff though.
Thanks, that did the trick.
Removing the include and unchecking the indexer.follows.symlinks allows me to move methods from one class to another now.