def plugin_loaded():
    """
    Called automatically by Sublime when the API is ready to be used.
    Updates coverage for any open views, and adds them to the mediator.
    """

    config.load()

    # add open views to the mediator
    for window in sublime.windows():
        debug_message("[plugin_loaded] Found window %d" % window.id())
        for view in window.views():
            debug_message("[plugin_loaded] Found view %d" % view.id())
            mediator.add(view)
            set_timeout_async(
                lambda: view.run_command('phpcoverage_update'),
                1
            )

    debug_message("[plugin_loaded] Finished.")
Пример #2
0
 def prepare_callback(self, callback, view):
     """
     Wraps a callback function in a lambda to add a view as an
     additional parameter, and to be run in the main thread.
     """
     return lambda data: set_timeout_async(lambda: callback(view, data), 1)
 def on_close(self, view):
     """
     Unregister any listeners for the view that was just closed.
     """
     set_timeout_async(lambda: mediator.remove(view), 1)
Пример #4
0
 def prepare_callback(self, callback, view):
     """
     Wraps a callback function in a lambda to add a view as an
     additional parameter, and to be run in the main thread.
     """
     return lambda data: set_timeout_async(lambda: callback(view, data), 1)