Hi All,
I am working on a little enhancement for a plugin, here is what I am trying to do
- User invokes a command which opens a
show_quick_panel
with a list of options (1, 2, 3…) - Once the user picks an option from I pass an
id
to the myon_done
callback - Inside
on_done
I am trying to update the view based on user option selection which is mostly replacing content in the view - when I try to use
edit
from thecallback
I get an error sayingedit cannot be used outside of run
I assumeon_done
callback runs at a later time without access to theedit
object - Now how can I replace content I also explored looking into
run_command
withreplace_text
- I tried doing
self.view.run_command('replace_text', { "region": sublime.Region(0, 10), "text": "some super stuff" } )
I got an error message sayingTypeError: Value required
not sure what I did wrong
What is the idiomatic way to do this? ideally I would like to access the edit object inside my callback
since I already have a helper method which updates the view in other places so I could use the same
Lastly I looked into edit.py
which creates a reference to the view for later use? when I tried using it I see a new copy of the view and my replace
still doesn’t happen
I need help