chenhehe
chenhehe

Reputation: 75

What API should I use to write a sublime-text plugin to show the hints

Like this. What API should I use to show this box?

completion menu


update: I successed in sublime-text 3,but failed in sublime-text 2.Do you know why? The code is:

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

Upvotes: 1

Views: 59

Answers (1)

Enteleform
Enteleform

Reputation: 3833

The auto-completion panel can be manually populated with the on_query_completions listener.

 

To view a functioning example of it's implementation:

  • Install PackageResourceViewer
  • Run PackageResourceViewer: Open Resource from the command palette
  • Select the CSS package and open css_completions.py

Upvotes: 1

Related Questions