4
我創建插件sublime text 3
3個命令運行WindowCommand插件:他們的型的,其中之一是WindowCommand
如何從`崇高console`
import sublime, sublime_plugin
class simple_text_pluginCommand(sublime_plugin.TextCommand):
def run(self, edit):
print("Hello World simple_text_plugin")
class simple_text_plugin2Command(sublime_plugin.TextCommand):
def run(self, edit):
print("Hello World simple_text_plugin2")
class simple_window_pluginCommand(sublime_plugin.WindowCommand):
def run(self):
print("Hello World simple_window_plugin")
爲什麼我可以從sublime command line
致電(按Ctrl +`)只有文本命令:
>>> view.run_command('simple_text_plugin')
Hello World simple_text_plugin
>>> view.run_command('simple_text_plugin2')
Hello World simple_text_plugin2
但不能調用window
命令:
>>> view.run_command('simple_window_plugin')
沒有輸出。如何從sublime console
運行Window
類型的插件?
使用'window.run_command(「simple_window_plugin」)'。檢查這篇文章http://stackoverflow.com/questions/19532204/in-sublime-why-is-def-run-working-in-one-case-and-not-another-case-and-how-can/19533899 #19533899。 – longhua