I found that if we use time.sleep() in plugin this leads to editor stop responding. How to implement delay functionality without affecting sublime workflow?
I guess you can use the
sublime.set_timeout_async depending on your needs. Both functions are thread safe and doesn’t block the main UI. My guess is
time.sleep() is a blocking call that interferes with the main thread, hence the editor stops responding.
time.sleep() suspends the current thread for a certain amount of time, if done within a synchronous callback this will also suspend the main application.
Can you provide a simple example for
The function just takes a callback function & a delay, which indicates the time after which the callback must be executed. You can find the API reference here :- https://www.sublimetext.com/docs/3/api_reference.html#sublime
I was unable to use
I wasn’t adding delay to function like
Can you please tell what are you trying to accomplish with
set_timeout_async and what have you tried on your end ?
time.sleep() will halt the code execution for the specified time. The closest to something similar to
time.sleep() in the API are the 2 methods referred above.