CMD + click on method opens file in excluded directory

I love the Webstorms functionality where you click a method/function and it opens the file where the method is defined. But more often than not, a file is opened that is in an excluded directory.

In the screenshot you see it opens the file three excluded directories down.
And this is in the same directory (Repos/common-library). Sometimes it even chooses a whole different directory (Repos/xxx/node_modules/ etc...)

I've tried resetting my Repos directory and manually excluding all folders again, but to no avail.

Am I doing something wrong?

10 comments
Comment actions Permalink

Hi! Could you please precise what behavior you expect and what file should be opened?

0
Comment actions Permalink

Hi! Let me explain it a bit further.

For the project I'm working on we got multiple repositories linked to each other.
For example:
- Common-library
- Client-library

Common library has a directory called services with the offer.service.ts.
It also has a directory (on the same level as services) called components. Within the components directory I have a Offer Component. Within that Offer Component I call a method in the offer.service.ts file.

The method is also present in other directories.
Within the Common library, there is a dist directory that is created automatically when compiling the code.
Within the Client library a node_modules directory is present with all linked libraries, including Common Library.
More often than not, CMD+clicking the method in the Offer Component, opens the file the method is present in (in this case offer.service.ts) but from the wrong directory. And the wrong directory, is a directory I excluded from indexing. In this example, that's the dist directory or the node_modules directory.

Here you see that the src/client/services directory is included, but the dist directory is excluded. You can also see that the node_modules file is excluded. This is the same for all libraries.

What I expect is that CMD+clicking a method opens the file the method is present in from a directory that is included. It won't open a file from an excluded directory.

I'm expecting this to be standard behaviour, since searching for files doesn't include files from excluded directories. So I thought I was doing something wrong.

0
Comment actions Permalink

Cmd+clicking never opens files from excluded directories - as files from excluded folders are not indexed, they can't be used for navigation. So it seems that your dist folder is not actually excluded for some reason. Do you have symlinks in your project path? Please also make sure that excluded folders are not set up as JavaScript libraries

0
Comment actions Permalink

As far as I know my folders are correctly excluded. I triple checked before turning to here.

The folders are not set up as Javascript libraries, but my project repositories do contain symlinks. Two general libraries are included in multiple projects. But to my knowledge that's pretty common. And I don't see why it shouldn't just open the files from those actual directories instead of exlcuded folders.

0
Comment actions Permalink

excluding doesn't work as expected for symlinked folders. Please see https://youtrack.jetbrains.com/issue/IDEA-127022#comment=27-2375559 for possible workaround.

In general, WebStorm doesn't play well with symlinks/junctions, they cause various issues - for example, it recognizes symlinked files/folders as 2 entries and doesn't 'merge' them (https://youtrack.jetbrains.com/issue/IDEA-85774), cyclic links can cause performance issues when indexing, fsnotifier tool we use to synchronize the IDE virtual file system with external changes doesn't support them (https://youtrack.jetbrains.com/issue/IDEA-65174). So I'd suggest to avoid using them if possible

0
Comment actions Permalink

Avoiding is not possible.

The workaround is not clear as to where to find this registry property. Do you know?

0
Comment actions Permalink

Help | Find action, type Registry to locate it

0
Comment actions Permalink

Found the Registry, thank you, but sadly nothing in the nature of 'indexer.follows.symlinks'.

0
Comment actions Permalink

what IDE version do you use? This option is there in 2017.2.4:

0
Comment actions Permalink

I appeared to still be on 2017.1.4. Updated and found it. Thank you. Hope this helps.

0

Please sign in to leave a comment.