WebStorm monorepo code completion not working for inner project

Hi, in my case code completion is not working for inner monorepo project when I try to import any classes that is in the outer project of the monorepo.

 

I have the following monorepo structure with projects A and B. I use project A as the root in WebStorm

A/package.json

A/src/

 

A/B/package.json

A/B/src

When I'm inside A/B/src and trying to import a class that is declared inside A/src/, no code completion is showing for those classes.

The moment I remove A/B/package.json, code completion starts to work.

Any suggestions? So far I had to move sources to A/B_Src/src to use code completion and build it from A/B/. This is working but is very clunky.

Anyway to tell code completion to look into A/src despite of presence of the A/B/package.json file?

Environment:

WebStorm 2025.1.1
Build #WS-251.25410.117, built on May 7, 2025
Source revision: f16670c80a66d
Runtime version: 21.0.6+9-b895.109 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 15.5
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 3048M
Cores: 10
Metal Rendering is ON
Registry:
 ide.experimental.ui=true
Non-Bundled Plugins:
 com.intellij.laf.macos (251.23774.318)
 org.jetbrains.plugins.gitlab (251.25410.159-IU)
 org.jetbrains.plugins.github (251.25410.159-IU)
 com.github.copilot (1.5.45-243)
 

0
9 comments

Would it be possible to narrow the problem down to a minimal repo project and share this with us?

1

Elena Pogorelova 

Here is the minimal project:

https://drive.google.com/file/d/1_42gTUQiuEg-Lbm8vQbTe7EbNa4TA4aV/view?usp=drive_link

While I was setting it up, I realized this is specific to .vue files - in A/B/src project when I type a name of a component inside <template>, suggestions are only limited to the components from project B/src and it doesn't show components from A/src

 

Steps to reproduce:

 

Case1:

- open A/B/src/CompB.vue

- under <template></template> start typing <Comp

actual result: only CompB and CompB2 are shown in suggestions

expected result: CompA, CompA2, CompB and CompB2 are all provided in the suggestions

 

Case2:

- delete or rename A/B/package.json

- under <template></template> start typing <Comp

actual result: now CompA, CompA2, CompB and CompB2 are all shown in the suggestions

expected result: A/B/package.json should be in place but it needs to be removed for the code suggestions to work.

0
Thank you.
To make the completion work, you need to either remove the A/B/package.json or add a dependency on `a` to it.
0

Elena Pogorelova 

or add a dependency on `a` to it

What do you mean by that? How do I do that?

0
I you like to use components defined in a separate package, you need adding this package as a dependency to a package.json of your module.
0

Thanks Elena Pogorelova, this didn't help though.

Just to clarify, this is a monorepo and A/src is not a separate package per se, technically it's a folder, one level higher.

Inner project needs to access common code within the monorepo and everything works well except for the code completion. 

Looks to me like a rather common scenario for monorepo and code completion should just work, but I'm not sure what I'm missing.

Anyway, I tired adding dependency within A/B/package.json, but it didn't help with the code completion. Still only shows packages specific to A/B/src and no A/src suggestions

"dependencies": {
  "a-project": “file:../”
}

I can't remove A/B/package.json either as it lists dependencies specific to the A/B project and I think this is expected to have it there for monorepos. Or am I wrong here?

Again, from build perspective my monorepo setup works just fine - webpack resolves all the paths, everything deploys to the server as needed. 

It's just for some reason WebStorm has issues with code completion in this case. 

Is it a WebStorm bug/limitation?

0

Thank you for sharing all the details. I've created a new ticket: WEB-73440. Please vote for it to get notified of the updates.

0

Thanks Elena Pogorelova! I assume there is no ETA for this and I just keep working they way I do while keeping an eye on the ticket?

0
Yes, exactly.  As soon as we have a fix for this, we’ll update its status on YouTrack.
0

Please sign in to leave a comment.