python - 崇高文本 3 : Write text to output panel

标签 python sublimetext3 sublime-text-plugin

我正在尝试创建一个 Sublime Text 3 插件,它将输出写入当前窗口中的输出面板。我发现了很多使用 begin_edit 和 end_edit 来执行此操作的示例,它们在 ST3 中不再受支持。据我了解,ST3 要求我定义一个 TextCommand 以支持我的输出面板上的编辑操作。到目前为止,我所拥有的是:

class SfprintCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.insert(edit, self.view.size(), 'hello')

class SfCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.panel = self.view.window().create_output_panel('sf_st3_output')
        self.view.window().run_command('show_panel', { 'panel': 'output.sf_st3_output' })
        self.panel.run_command('sfprint');

我希望这应该在我的输出面板中打印文本“hello”,但是当我尝试通过控制台调用它时(通过运行 view.run_command('sf')),这会显示新面板,但不会向其打印任何信息。如何向该面板写入文本?

最佳答案

重新启动一切后,相同的代码现在似乎可以正常工作了。我的经验教训:显然最好不要过于相信 ST3 的热插件重载!

关于python - 崇高文本 3 : Write text to output panel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34338160/

相关文章:

python - 在 Python Pandas 中派生新列时出现 ValueError

rust - 如何配置 SublimeLinter-contrib-rustc 以找到 "piston"箱子?

python psycopg2 - ProgrammingError : function crosstab(unknown, 未知)不存在

python - python 如何正确使用2to3?

python - 从python数组中选择多个元素

sublimetext3 - 崇高的文本 3 : Removing build systems

html - CSS 拒绝更新

html - 如何打开~~~ .sublime-package文件?

html - 在 HTML sublime text 2 中自动完成 css 类或 id