Sublime Forum

Import custom plugin in SublimeText?

#1

I implemented a customized autocompletion plugin for SublimeText:

import sublime_plugin
import sublime

test = ["class.test", "class.okok"]

class TensorflowCompletions(sublime_plugin.EventListener):

    def __init__(self):

        self.test_completions = [("%s \tCustom completions" % s, s) for s in test]

    def on_query_completions(self, view, prefix, locations):

        if view.match_selector(locations[0], "source.py"):

            return self.test_completions

        else:

            return []

So I added this python file into the User folder into Packages folder. Then I restarted Sublime Text but when I type “class” it doesn’t suggest my customized autocompletion list.

Did I do something wrong ?

0 Likes

#2

Are you testing with the pain text syntax? ST doesn’t offer completions as you type when inside files scoped as text, but triggering the completion popup manually should make them show up.

1 Like