关于on_query_completions的st2和st3之间的区别

时间:2016-04-17 09:16:07

标签: python sublimetext2 sublimetext3 sublimetext sublime-text-plugin

我想展示自动完成面板,并且我使用API​​ on_query_completions在sublime-text 3中成功,但是我使用相同的代码在sublime-text2中失败。

代码:

import sublime, sublime_plugin

class CCAutoComplete(sublime_plugin.EventListener):
     def on_query_completions(self, view, prefix, locations):
        flag = sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
        result = ([["abv","abv"],["abcd123","abcd"]],flag)
        return result

1 个答案:

答案 0 :(得分:0)

使用元组数组作为完成值而不是2D数组:

[("abv","abv"),("abcd123","abcd")]