Sublime Forum

Why no return value for plugin command run() method?

#1

Please help me understand…

What is the reason behind a plugins run() method not allowing for the returning of values? Say from within one command you wanted to run another command… but you need to know whether something failed before proceeding. This is what return values are for…

psudo code:

result = sublime.active_window().run_command(‘go_do_this’)
if result successful:
yay
else:
ohcrap do this instead

(note: result is always none)


I’m guessing there is a good reason for this default behavior and that I lack understanding. But if there really isn’t any reason why this shouldn’t be possible with some custom code, could someone please point me in the right direction to accomplish this task?

Thanks :slightly_smiling:

0 Likes

run_command return code
#2

Indeed, it’s a bit weird, but you can’t… :disappointed:

What command are you actually running? Is it a custom one?


Might save time to some people: passing by reference doesn’t seem to work…


@stupid (weird name, no?) Have a look here: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet

0 Likes

#3

Howdy,

don’t know if you saw, but a few guys chimed in on this issue on this thread the other day. Yeah, I’ve got a ton of custom commands and some get pretty involved. So far the only way to do this is courtesy of @rwols -hat tip sir- He figured out a way… its a little dirty… but I’m going with it…

as for my handle… lol

0 Likes