vscode and angular:自动导入/导出/声明来自另一个模块的组件

发布于 2025-01-23 22:42:31 字数 691 浏览 2 评论 0原文

我已经使用了WebStorm一段时间了,但是由于某种原因,我决定移至VScode。 在大多数情况下,除了一个问题外,一切都适合我。

如果我创建一个模块(例如 core ),然后在“ core ”模块中创建一个组件(例如, header ),则当我尝试使用“ core ”中的组件时,在“ app.component.html ”中(< app-header></app-header> )如果我在“ core ”模块中正确声明出口和“ app ”模块中的声明,我会遇到汇编错误。

在WebStorm中,如果我在模板中指定一个组件选择器,那么一切都会自行发生,而我不需要自己的手来做。即使我专门删除了组件的导出,也会出现提示,这要归功于我可以修复所有内容。

可以在VSCODE中实现相同的功能吗?

I've been using WebStorm for a while, but for some reason i decided to move to VSCode.
For the most part, everything suits me, except except for one problem.

If i create a module (for example, core) and create a component (for example, header) inside the "core" module, then when i try to use the component from "core" in "app.component.html" (<app-header></app-header>) i get compilation errors that disappear if i make a proper declaration of exports in "core" module and declarations in the "app" module.

In WebStorm, if i specify a component selector in the template, then everything happens by itself and i don't need to do it with my own hands. Even if i specifically delete the export of the component, a hint will appear to me, thanks to which i can fix everything.

enter image description here

Is it possible to achieve the same in VSCode?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文