st2和st3的区别大约on_query_completions

The difference between st2 and st3 about on_query_completions

我想显示自动完成面板,我在 sublime-text 3 中使用 API on_query_completions 成功了,但我在 sublime-text 2 中使用相同的代码失败了。

代码:

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

使用元组数组代替二维数组作为完成值:

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