Webstorm 2020.1 go to definition not working for named imports typescript

I'm sure this is a configuration somewhere but I can't find it. I have the same project running in both WS2019 and 2020. In WS2019, when working with typescript files I can "go to definition" (when bar below is selected) for an imported module and it would take me to the typescript source file. 

```

import { foo, bar } from '@package/module';

```

If I try to do this in WS2020 it only finds usages in the current file, even though "All Places" is selected in Scope.

Both 2019 and 2020 have the same preference setup for:

Languages and Frameworks > typescript

Languages and Frameworks > javascript > libraries

 

 

Any help appreciated.

7 comments
Comment actions Permalink

please try invalidating caches (File > Invalidate caches, Invalidate and restart) - does the issue persist?

If yes, please share a minimal sample (project/files) the issue can be reproduced with

0
Comment actions Permalink

Hey Elena, Thanks for the tip.
Invalidating caches didn't work. I did notice that when importing a library like React I was able to got to definition. But I wasn't able for my custom libraries.

I should point out the we are using a "Lerna" mono repo. So we have a lot of import from the following structure:

```

/root-lerna/

/root-lerna/packages/module-1

/root-lerna/packages/module-2

```

When importing files from module 2 into module 1:

```

import { foo, bar } from '@namespace/module-2'

```

In Languages > Frameworks > javascript, I have automatically generated libraries like:

```

/root-lerna/packages/module-2/node_modules

```

The checkbox for this entry is a dash, not a checkmark.

 

To get this working I've added a custom library, framework type is custom and scope is project, and specified the module root as the path, e.g:

```

/root-lerna/packages/module-2/

```

 

While this is working, I'm not sure why this extra step is needed compared to WS2019?

0
Comment actions Permalink

this should work with lerna workspaces, I'm not aware of any changes in 2020.1 affecting this.

Sample project the issue can be reproduced with would be helpful

0
Comment actions Permalink

Thanks again for the response Elena, I'll see if I can replicate the issue with a dummy project derived from a subset of this projects files

1
Comment actions Permalink

I've worked out the problem. For my original project, I had marked all the typescript compile directories as "excluded". I was doing this to prevent search results from displaying code in these directories. This approach worked in WS2019, but not in WS2020.

So the new question becomes, how can I exclude directories from being searched, but maintain the links to definitions?

0
Comment actions Permalink

Hmm... marking build target folders excluded has always been recommended for better performance and searching experience... Could you share a dummy project that shows up the issue (broken navigation with target folders excluded)?

0
Comment actions Permalink

Just unmark node_modules as excluded.
Let the editor index all node modules for the first time.

After the indexing you can mark node_modules es excluded again.

0

Please sign in to leave a comment.