Komodo 7或8的Django代码补全

5 投票
2 回答
724 浏览
提问于 2025-04-17 18:23

我正在使用Komodo 7来编写我的django/python代码。

我在用Eclipse做Python编程的时候,有一件我特别喜欢的事,就是我可以这样做:

assert isinstance([variable],[type])

这样可以帮助Eclipse判断特定变量的代码补全。

请问在Komodo中有没有办法做到这一点?IsInstance这个技巧在这里不管用。

2 个回答

1
Go to Edit > Preferences. 
Expand the "Languages" group by clicking the [+] symbol. 
Click "Python". 
Click the little "Add..." button under "Additional Python Import Directories". 
Add the directory ABOVE your project and you should have intellisense enabled.

这将让你在你的项目文件(Django)中看到代码补全的功能。

3

interjay 对于 这个类似问题的回答提到,你可以添加一些提示,比如:

if 0: foo = Bar()

在你习惯使用的地方

assert isinstance(foo, Bar)

当然,这样看起来没那么好看...

补充:我在使用 Komodo Edit 6.0.3 和 Komodo Edit 8.0.0 时,这个方法对我有效。

补充:我还发现了 这个链接,里面说明没有其他方法(而且短期内也不太可能有)。

撰写回答