nephiw
nephiw

Reputation: 2046

How can I configure WebStorm to stop importing the full Typescript paths?

Recently there was an upgrade in WebStorm (I think) and it changed how paths were imported in my files. Previously, if I typed @Component and allow WebStorm to automatically import the path, it would use this form:

import { Component } from @angular/core

But recently it has started pulling in the full paths instead:

import { Component } from '@angular/core/src/metadata/directives';

Is there a configuration change I can make to address this?

[EDIT] I discovered that if I copy and paste code into a file, it will import the dependencies properly. This feels like a bug that my particular configuration is revealing.

It appears that the only libraries that do this are Angular libraries, so I suspect the problem is with the Angular plugin. I have reached out to JetBrains and they have no answers.

Upvotes: 1

Views: 1064

Answers (1)

nephiw
nephiw

Reputation: 2046

And like that, one day, I log back in to discover the bug has been fixed. This appears to have been a problem with the Angular Plugin as imports for other libraries worked properly. Things that I tried to fix this include:

  • Restart Webstorm/Whole OS (I come from the Windows world)
  • File > Invalidate Caches / Restart...
  • Nearly every configuration of import options.
  • Fix a broken Webpack.config (give a default entry point)
  • Reinstall the Angular Plugin
  • Delete all WebStorm Configuration, restart and rebuild configuration by hand.
  • File a bug report with JetBrains which resulted in the support staff saying "I don't know"

None of the above did anything. I would love if someone from JetBrains would help me understand how to better help them understand bugs I find.

This isn't exactly a fix for the bug, but if anyone else discovers this happening in their code, hopefully, this will help them debug.

Upvotes: 2

Related Questions