Search code examples
pythonsublimetext2sublimetext3sublimetextsublime-text-plugin

The difference between st2 and st3 about on_query_completions


I want to show the auto-completion panel,and I successed in sublime-text 3 using the API on_query_completions,but I failed in sublime-text2 using the same code.

The code:

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

Solution

  • Use an array of tuples for the completion values instead of a 2D-array:

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