简体   繁体   English

Intellij“查找用法”不适用于Lerna软件包

[英]Intellij “Find usages” doesn't work across Lerna packages

I have a typescript monorepo setup with Lerna . 我有一个与Lerna的打字稿monorepo设置。 I am observing a bug (or a misconfiguration on my part) with the "find usages" feature. 我正在观察“使用习惯”功能的错误(或者我的配置有误)。

I have a GitHub repo that reproduces the issue here: https://github.com/mcclaskc/IntellijLernaExample 我有一个GitHub存储库,可在此处重现该问题: https : //github.com/mcclaskc/IntellijLernaExample

Let's say I have package A, with function a() , and package B, which includes A as a dependency in package.json, and uses a() . 假设我有一个具有函数a()程序包A和a()具有程序包B,该程序包B在package.json中包含A作为依赖项,并使用a()

In Intellij, at the declaration of a() , if I try to "find usages" of a() , no results turn up. 在Intellij中,在a()的声明中,如果我尝试“查找a()用法”,则没有结果。 However, if I am inside B, click on the usage of a() , and I try to "go to declaration" of a() , it works, and navigates me to the declaration in the A package. 但是,如果我在B里面,请单击a()的用法,然后尝试“去声明” a() ,它会起作用,并将我导航到A包中的声明。

Since the "go to declaration" works, I know Intellij is aware of the dependency in one direction, I just need to figure out how to make it aware in the other "find usages" direction. 由于“声明开始”有效,因此我知道Intellij知道了一个方向的依赖关系,我只需要弄清楚如何使它在另一个“查找用法”方向上就可以知道。

I have already tried messing with the Find Usages options scope, to no avail. 我已经尝试弄乱“查找用法”选项范围,但无济于事。

The problem is that you have separate IDEA modules created for your Lerna packages. 问题是您为Lerna软件包创建了单独的IDEA模块。 JavaScript/Typescript usages are not found across IDEA modules boundaries - this is a known limitation. 跨IDEA模块边界找不到JavaScript / Typescript用法-这是一个已知限制。 You can navigate to exported functions because they are imported explicitly and can be found by import paths, but searching for exported functions usages in submodules will return no results... There is a feature request to support multi-modules apps, WEB-37907 , please feel free to vote for it. 您可以导航到导出的函数,因为它们是显式导入的,并且可以通过导入路径找到,但是在子模块中搜索导出的函数用法将不会返回任何结果。...有一项功能要求,以支持多模块应用程序WEB-37907 ,请随时投票。 For now, I can only suggest keeping all Typescript code in a single IDEA module 目前,我只能建议将所有Typescript代码保留在单个IDEA模块中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM