简体   繁体   English

如何调试PyDev的自动完成服务器以找出为什么它无法分析模块?

[英]How do I debug PyDev's autocompletion server to figure out why it can't analyze a module?

I'm using PyDev to edit Python and have a module that can't be analyzed statically or as a forced builtin. 我正在使用PyDev编辑Python,并且有一个无法静态分析或作为强制内置模块进行分析的模块。 How do I debug the autocompletion server Python process that PyDev runs to figure out why it can't provide completions for this module, and hopefully tweak things to make it work? 如何调试PyDev运行的自动完成服务器Python进程,以弄清楚为什么它无法为此模块提供完成功能,并希望对其进行调整以使其正常工作?

Well, the completions in the forced builtins are mostly driven by doing a dir() in the module and then getting the tokens (so if you can do that from a shell, the code-completion engine should be able to do it too -- but note it'll only import and do a dir, not actually execute your code). 好吧,强制内置函数的完成主要是通过在模块中执行dir()然后获取令牌来驱动的(因此,如果您可以从shell中执行此操作,则代码完成引擎也应该能够执行此操作-但请注意,它只会导入并执行一个目录,而不会实际执行您的代码)。

Also, this will only work for code which is not below your project (ie: code which is from an external library in the system interpreter) 此外,这仅适用于项目以下的代码(即:来自系统解释器中外部库的代码)

For analyzing your own code (below a project), PyDev will only use the static analyzer... in which case it depends on the code, you can usually enhance it with type info on docstrings: http://pydev.org/manual_adv_type_hints.html or by doing some 'if False:' and writing some code which would only be gotten for the static analysis... 为了分析您自己的代码(在项目下),PyDev将仅使用静态分析器...在这种情况下,它取决于代码,通常可以使用文档字符串上的类型信息来增强它: http : //pydev.org/manual_adv_type_hints .html或执行一些'if False:'并编写一些仅用于静态分析的代码...

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

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