[英]Drill to C source code definition when in a Python file (VSCode)
I want to navigate to the definition of modules implemented in C from my Python file. 我想从我的Python文件导航到用C实现的模块的定义。
VSCode can drill to the definitions of my python objects. VSCode可以钻取到我的python对象的定义。 Some are found automatically, while others, I need to point to.
有些是自动找到的,有些则需要指出。
To add additional locations I add the following to my user VSCode settings: 要添加其他位置,请将以下内容添加到我的用户VSCode设置中:
"python.autoComplete.extraPaths": [
"C:/Users/me/Desktop/external_python"
],
This works fine and I can right click on objects and 'Go To Definition'. 这可以正常工作,我可以右键单击对象并单击“转到定义”。
I want to drill even further; 我想进一步钻探; into the C implementation.
进入C实现。 Now, python modules implemented in C are compiled.
现在,编译了用C实现的python模块。 However, I have access to the *.h and *.c files which generated the shared objects.
但是,我有权访问生成共享库的* .h和* .c文件。 So, theoretically, I could jump from my python files into .h/.c files of C from within VSCode
因此,从理论上讲,我可以从VSCode中从python文件跳转到C的.h / .c文件
Is it possible to navigate from a python file into the source code of a compiled module? 是否可以从python文件导航到已编译模块的源代码?
It's not possibly to drill down from the Python code to the matching C code via definition. 通过定义不可能从Python代码深入到匹配的C代码。 Visual Studio may provide such functionality, but since VS Code lacks any direct ties to the object files there's no way to do the reverse lookup from Python name, to object file, to original source.
Visual Studio可能提供了这样的功能,但是由于VS Code与目标文件没有任何直接联系,因此无法进行从Python名称到目标文件到原始源的反向查找。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.