Visual Studio Cod中的调用层次结构

2024-05-16 22:08:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在Visual Studio/VSCodium中找到一个“查看调用层次结构”功能。

我要做的是右键单击一个方法的名称(或按键盘快捷键),然后打开一个新的窗格,显示所有调用单击的方法的方法,以及此方法的调用树。

我在Eclipse和PyCharm中发现了这一点,但我只在VSCode中找到了“查找所有引用”。

编辑:我想用Python来实现,但是如果所有语言都有这样的特性,那就太好了。


Tags: 方法功能名称编辑层次结构键盘vscode快捷键
1条回答
网友
1楼 · 发布于 2024-05-16 22:08:27

这是目前(v1.33)的一个预览功能。见release notes re: call hierarchy

A call hierarchy view shows all calls from or to a function and allows you to drill into callers of callers and calls of calls. The image below shows that function foo is being called by bar and bang, then bar is being called by bang and fib.

call hierarchy demo picture

This is a preview feature and there aren't any extensions currently providing real data for it. However, if you are an extension author, we invite you to validate our proposed API. If you are interested, there is a sample extension for testing: https://github.com/jrieken/demo-callhierarchy.

已经有一个绑定命令,editor.showCallHierarchy。您必须查看是否有任何python扩展支持此功能。

相关问题 更多 >