如您所知,您可以在 VSCode 中启用以下设置以在编辑器中查看引用:
"typescript.implementationsCodeLens.enabled": true,
"javascript.referencesCodeLens.enabled": true
正如您在下图中看到的,没有引用(参见下面的代码和方法名称“myOperations”上方的灰色引用信息文本)0 个引用
)
但实际上,它是存在的!它存在于一个 Angular 模板中:
<div class="some-cool-class">
<my-super-thing
*ngIf="ifItIsCool"
(operations)="myOperations($event)"
>
</my-super-thing>
我能以某种方式处理吗?我怎样才能看到模板中的引用(方法调用)?
最佳答案
2021 年 1 月 26 日编辑(来自 Johan Aspeling):
Seems to have finally been fixed with the new Ivy language service (used in Angular 11) Angular Language Service v11+
===
Angular 的官方语言服务不支持该功能。
There is an open issue to add it两年多来完全被忽略了,a second issue opened a year ago这也被忽略了。
关于angular - 如何在 VSCode 的 TypeScript 文件中显示来自 HTML 文件( Angular 模板)的引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57902649/