WebStorm not AutoComplete local typescript packages
I'm working with My application is devided to some local packages that some have dependencies to other local packages(In my package.json's dependencies, it is local path to the packages). My problem is that webstorm does not autocomplete code when im using classes and methods from my local packages. For example: Suppose i have in my app package A that exports some classes(for Example Animal).
And when i am trying to use methods of Animal from package A in package B, it does not auto complete. |
Please sign in to leave a comment.
Please can you elaborate on this? Are all these packages located in the same project? How do you import them? Sample project would be helpful
yes they are all located in the same project.
every folder is package(it contain package.json), and some of them have dependencies to other packages located in my project.
From npm v2, there is support for local dependency path written here.
In my dependent packages, inside my package.json, i wrote "typings" property that lead to my index.ts(where all my classes exports defined.
Similar, but not exactly the same, example would be project i found here.
can't see any issues when using similar projects (I'm using 2017.1 EAP, but 2016 should work in similar way. Please check the sample project I've uploaded to ftp: ftp://ftp.intellij.net/pub/.idea/npm_local/npm-local-dep.zip. Package p2 there depends on local package p1. Can you recreate the issue using it?
wow i think this is the very same thing im doing in my own project at office.
the project in my office is inside local network, tomorrow i will compare the two to see the difference.
Some facts that maybe related:
- At my office im using webstorm version 2016.2 and not 2016.3 as in my own pc.
- The tsconfig is inside every package, and not in the root project.
- Im using outDir in my tsConfig, to generate the js package to different folder.
- In Settings -> TypeScript im using "Use tsconfig.json" option.
- The webstorm is running inside local network.
I dont know what i wrote is relevant, but im trying...
I will write another comment after i will compare them tomorrow.
Thank you very much for your help!
I really could not find the difference between the projects... i guess i will try to upgrade webstorm version and try again. Thank you for your help!
Idanf2, did you finally solve the issue? I'm having the same problem
@Jlg Hrtc please share a sample project that can be used to recreate the issue
Found a "solution".
I have 3 projects in the same project (with the attached feature).
One of the 3 projects was not getting suggestions from the other local package (using "file://" in package.json dependencies...).
And I found that this was happening because of the symlink in node_modules/other_local_package. Webstorm cannot go through symlinks (or maybe it is typescript that cannot). I know this because turning the symlink into a regular folder made autocomplete suggestions work.
I found that in 1 of these 3 projects I was getting autocomplete suggestions, so I decided to investigate.
In the project that wasn't working, in the .idea\projectname.iml file, I added these lines with the names of the 2 other projects:
<orderEntry type="module" module-name="first-project" />
<orderEntry type="module" module-name="second-project" />
and here is how I got suggestions.
But I still think I'm getting suggestions because everything are files that are in the "same workspace" in webstorm. If I had a symlink to another package not opened in webstorm, I wouldn't be getting any suggestion at all.
I think that with all this information you can try to make a similar scenario, 3 projects attached in "one window", each project has an npm package, and they use them mutually in package.json using "local dependencies".
I'm using win10 btw.
@Elena Pogorelova is the behavior described by Jlh Hrtc confirmed, if yes is there a workaround or even a permanent fix?
No, it's not. I need a sample project to see what's wrong
I "fixed" it by adding the local project/dependencie-package in the Settings (Languages>Java Script>Packages) i do not know if this is the intended behaviour or if it should be picket up immediately/by itself. If it should work without manually adding it I can create a reproduceable example