【发布时间】:2019-05-03 21:46:42
【问题描述】:
我正在使用 sublime_plugin.EventListener 类创建 SublimeText3 插件。我想通过 on_query_completions 方法将key1 替换为replace1。但我不能那样做。如何知道绑定类方法到 on_query_completions 方法?或者,如何替代?
class MyPlugin(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
""" success, but this is not to hoped """
return [
['key1', 'replace1'],
['key2', 'replace2'],
]
def on_query_completions(self, view, prefix, locations):
""" not working, but this is I hoped """
return [
['key1', self.replace1],
['key2', self.replace2],
]
def replace1(self):
return 'replace2'
def replace2(self):
return 'replace2'
【问题讨论】:
标签: sublimetext3 sublime-text-plugin