Ignore symlinks in project (indexing, code-completion etc)

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?

26 comments
Comment actions Permalink

Hi there,

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:

 

0
Comment actions Permalink

Well it would be easy to fix:

  • Ignore symlinks within the same project
  • Accept symlinks which point outside the project
7
Comment actions Permalink

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. 

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000556530-IntelliJ-2017-2-2-constantly-freezing-in-a-Symfony-project-

 

0
Comment actions Permalink

@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...

0
Comment actions Permalink

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.

0
Comment actions Permalink

 

This just affected me. REALLY freaking annoying and quite frankly absurd this hasn't been resolved.

0
Comment actions Permalink

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

3
Comment actions Permalink

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.

1
Comment actions Permalink

Replied in another thread

0
Comment actions Permalink

Marking them symlink directories as Excluded sounds about right to me.

0
Comment actions Permalink

Replied in another thread

Dmitry Tronin which thread?

0
Comment actions Permalink

I believe it's that one

What issue are you experiencing exactly?

 

0
Comment actions Permalink

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.

0
Comment actions Permalink

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.

0
Comment actions Permalink

Thanks for the tip; I disabled the flag but `lib64` is still scanned during indexing after restarting PyCharm with 'Invalidate Cache'

0
Comment actions Permalink

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.

 

1
Comment actions Permalink

Searching by "simlink" in plugin marketplace from inside PHPStorm I can see these plugins exist too:

Exclude Symlinks
https://plugins.jetbrains.com/plugin/9613-exclude-symlinks

IDEA Resolve Symlinks
https://plugins.jetbrains.com/plugin/16429-idea-resolve-symlinks

Symlink Excluder (already linked above by Pavel)
https://plugins.jetbrains.com/plugin/16110-symlink-excluder

Each offers similar but not identical functionality, read the description for which does best for you.

0
Comment actions Permalink

> 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!

2
Comment actions Permalink

@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?

0
Comment actions Permalink

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

0
Comment actions Permalink

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...

0
Comment actions Permalink

Sorry, Michael, missed your comment.

Is there any chance that you have your package also added to "Settings/Preferences | PHP > Include path"?

0
Comment actions Permalink

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.

0
Comment actions Permalink

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.

0

Please sign in to leave a comment.