Sublime Forum

Is view transient/preview method

#1

It would be nice if there was access in the API to determine if a given view is transient (preview). I have tried every way I can think of, but I cannot seem to pin down when a view is actually opened or if it is a preview.

I have a plugin in which I need to perform some action when the file is actually opened. on_load is triggered when the preview is shown and never again, so I cannot use that or it will trigger during “goto anything”. The attributes of the view in every way seen to look like a normal view as far as I can tell. The id (view and buffer) never changes during the transition from preview to opened file.

It would also kind of be nice if there was a method that dumped all of the view settings. Currently we only know a setting exists if it is documented; if there was a method that would just dump the internal settings to a dict, we could more quickly figure out undocumented stuff.

6 Likes

on_load induced by preview in goto anything
On_load is not triggered in a new view with Ctrl+N
#2

For anyone else coming by, I got this to work like this:
view.window().get_view_index(view)[1] == -1
These transient views don’t have a tab index because they have no tab.

2 Likes

#3

maybe window.transient_view_in_group(group)

1 Like