Sublime Forum

[ST3] on_activated_async not called at ST3 launch

#1

When ST3 is launched, a on_activated is triggered for the active view.
But is there any reason that on_activated_async is not called ?

[code]def on_api_ready():
global api_ready
api_ready = True

for m in list(sys.modules.values()):
    if "plugin_loaded" in m.__dict__:
        try:
            m.plugin_loaded()
        except:
            traceback.print_exc()

# Synthesize an on_activated call
w = sublime.active_window()
if w:
    view_id = sublime_api.window_active_view(w.window_id)
    if view_id != 0:
        try:
            on_activated(view_id)
        except:
            traceback.print_exc()[/code]
0 Likes

Dev Build 3048
#2

I’ve added the call to on_activated_async() and everything seems to work fine:

[code] def on_api_ready():
global api_ready
api_ready = True

    for m in list(sys.modules.values()):
        if "plugin_loaded" in m.__dict__:
            try:
                m.plugin_loaded()
            except:
                traceback.print_exc()

    # Synthesize an on_activated call
    w = sublime.active_window()
    if w:
        view_id = sublime_api.window_active_view(w.window_id)
        if view_id != 0:
            try:
                on_activated(view_id)
                on_activated_async(view_id)
            except:
                traceback.print_exc()[/code]
0 Likes

#3

bump.
Please add this line to the next build, I’m tired to do it manually at each update.

0 Likes

#4

re-bump.

Either my request is plenty wrong, if so please tell me why.
Either this issue was lost in the limbo of this forum, thanks to the non existent bug tracker…

0 Likes

#5

Works For Me ™

>>> sublime.version()
'3048'

share the code?

0 Likes

#6

[code]import sublime, sublime_plugin

class TestAsyncCommand(sublime_plugin.EventListener):
def on_activated(self, view):
print(‘on_activated’, view.file_name())
def on_activated_async(self, view):
print(‘on_activated_async’, view.file_name())[/code]

-Close ST3
-Run ST3
-Look at the console

There’s only a on_activated for the current file, no on_activated_async.

0 Likes

#7

In addition, when you navigate in the Goto Anything popup:
-Opened files doesn’t trigger the on_activated event.
-Unopened files trigger the on_activated event.

Well, not very consistent.
I suppose we have to check view.window() to know if it’s a transient view ?

0 Likes

#8

bump.

0 Likes