Do event listeners only listen to “built-in” events?
I tried setting up an EventListener to listen for the execution of one of my TextCommands. Unfortunately, my simple test (below) seems to not be working.
When the EventListener runs, it prints out the command_name. Right now, it prints out the names for “built-in” text commands such as “copy”, “paste”, etc.
When I try to run my custom text command, via the console
v = sublime.active_window().active_view()
v.run_command(“test”)
The EventListener does not print out the text command_name: “test” as I would expect.
Am I missing something? Or do EventListeners only listen to “built-in” commands?
Thanks for any help
import sublime, sublime_plugin
class TestCommand(sublime_plugin.TextCommand):
def run(self, edit):
print("running TestCommand")
class TestListener(sublime_plugin.EventListener):
def on_post_text_command(self, view, command_name, args):
# this text command just ran
print('post command_name', command_name)