If I try something like this:
class FooCommand(sublime_plugin.TextCommand):
def run(self, edit, **kwargs):
self.edit = edit
window = self.view.window()
window.show_input_panel(
"Foo:",
"",
self.on_done,
None,
None
)
def on_done(self, text):
selection = self.view.sel()
for region in selection:
try:
self.view.replace(
self.edit,
region,
text
)
except Exception as e:
print("Captured error: {}".format(e))
I’ll get the next error Captured error: Edit objects may not be used after the TextCommand's run method has returned
, so my question is, how can i add text on the view’s selections (cursors) on the input_panel on_done callback?
Thanks in advance!