Howdy.
I’m trying to intercept a file loading. I open the file from the terminal and sublime with then proceed to create a new view and load the file contents.
In my plugin I listen to the on_new
, on_activated
and on_load
events (and many others). When loading a new file I get two events:
-
on_activated
, withview.file_name() == None
,view.name() == None
,view.is_loading() == False
-
on_load
, withview.file_name() == "something"
,view.name() == None
,view.is_loading() == False
I’d like to intercept the file load, so I can do some custom decoding, progressive loading and so forth, meaning, I want to listen to a pre_load event, just when the view is created but the file has not yet started to load (if that fits the workflow of how sublime loads files into new views). With that said, I’d expect the following events:
-
on_new
, withview.file_name() == "something"
,view.is_loading() == True
-
on_activated
, withview.file_name() == "something"
,view.is_loading() == True
-
on_load
, withview.file_name() == "something"
,view.is_loading() == False
When on_new is called, I’d expect the file to still not have been opened.
Then to interrupt loading, I’m thinking just closing the view and opening a new one and fill it with my content. Either that, or the view object could have a cancel loading function.
The current behavior is not useful at all.
Thoughts ?
Thank you.