I am trying to create a Sublime Text 3 plugin which writes output to an output panel in the current window. I have found a number of examples doing this using begin_edit and end_edit, which are no longer supported in ST3. To my understanding, ST3 requires that I define a TextCommand to support the editing action on my output panel. So far, what I have is this:
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');
I would expect that this should print the text "hello" in my output panel, but when I try to invoke this through the console (by running view.run_command('sf')
), this displays the new panel but does not print any information to it. How can I write text to this panel?
self.view.id()
in SfprintCommand's run method is the same asself.panel.id()
in Sfcommand's run method? are there any errors in the Sublime console? – Quarter