Sublime Forum

Sublime_lib 1.4 — ActivityIndicator, more enums, and better performance


(Started a new thread because the old one refers to an old version in the title and can’t be edited.)

sublime_lib is a Package Control dependency providing a variety of convenience features for other packages to use. Version 1.4 is now available with a number of new features and bug fixes. Highlights:


A high-quality implementation of the spinner that many packages use:

import sublime_plugin
from sublime_lib import ActivityIndicator

class ExampleCommand(sublime_plugin.WindowCommand):
    def run(self):
        with ActivityIndicator(self.window, 'Example Command'):

This will show an animated activity indicator in the window status bar while do_expensive_operation() runs:

Example Command [=         ]
Example Command [ =        ]
Example Command [  =       ]

(Remember, always run long-running operations in the async thread or in another thread to avoid freezing the interface.)


An enum with an apply method to simplify on_query_context implementations:

import sublime_plugin
from sublime_lib.flags import QueryContextOperator

class MyListener(sublime_plugin.EventListener):
    def on_query_context(self, view, key, operator, operand, match_all):
        if key == "my_example_key":
            value = get_some_value()
            return QueryContextOperator(operator).apply(value, operand)
            return None

v1.4.0 release notes

Complete API reference