I have a blahtestCommand(sublime_plugin.ApplicationCommand) class blahtestCommand(sublime_plugin.ApplicationCommand) with start, it fails.
Another class, it works with sublime_plugin.TextCommmand) .
I am a little puzzled by what a startup definition should look like. I know java (there was OOP programming 10 years ago, which I remember well), but I know a very small python. (therefore, I donβt quite understand that the class accepts the parameter since it was not in java, but I would make a weak assumption that this is a bit like "extends" -inheritance- or "implements").
I'm also trying to determine what the ST2 API documentation will tell someone that when a class has a sublime_plugin.TextCommand parameter, this def run line should look like this: def run(self, edit) , whereas when the class has a sublime_plugin.ApplicationCommand parameter sublime_plugin.ApplicationCommand , def def should look like this: I don't know what. (so thereβs still a big secret)
Note that view.run_('......') does not work for the blahtest class, it does not print 'aaaaaaaa'
There are no errors in the console. Plugin - whatever.py loads fine. Therefore, one method of starting the class is launched, although the other is not. blahtestCommand is really loading. I can put a line between def run and the blahtestCommand class to print β123456789β and it prints as soon as I save any.py because it restarts and no errors. It's just that his start method is not called when I do view.run_command ('blahtest')
import sublime, sublime_plugin class blahtestCommand(sublime_plugin.ApplicationCommand): def run(self): print "aaaaaaaaaaa" class butthiswillworkCommand(sublime_plugin.TextCommand): def run(self, edit): print "bbbb"
>>> view.run_command('blahtest') >>> view.run_command('butthiswillwork') bbbb
added by complete weird luck I managed to get it to work for WindowCommand
window.run_command('saef4',{"string":"abcd"}) , {"keys": ["ctrl+s", "ctrl+d"], "command": "saef4", "args": {"string": "abcd"} } class saef4Command(sublime_plugin.WindowCommand): def run(self,string): print "uabcccc"
In the future, I can clarify this question regarding running "run" in lofty api classes.