Sublime Forum

Sublime text custom plugin breaks after restart

#1

have a custom plugin file ‘ExpandAndFocusLeftPane.py’. The contents of it are

[code]import sublime, sublime_plugin

class ExpandAndFocusRightPaneCommand(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command(“focus_group”, {“group”: 1})
self.window.run_command(“set_layout”, {
“cols”: [0.0, 0.33, 1.0],
“rows”: [0.0, 1.0],
“cells”: [0, 0, 1, 1], [1, 0, 2, 1]]
})

class ExpandAndFocusLeftPaneCommand(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command(“focus_group”, {“group”: 0})
self.window.run_command(“set_layout”, {
“cols”: [0.0, 0.66, 1.0],
“rows”: [0.0, 1.0],
“cells”: [0, 0, 1, 1], [1, 0, 2, 1]]
})[/code]
When I restart sublime text, in the command prompt in sublime text, if I do

window.run_command('expand_and_focus_left_pane'), it reports an error.

>>> window.run_command('expand_and_focus_left_pane') Traceback (most recent call last): File "./sublime_plugin.py", line 339, in run_ TypeError: run() takes exactly 2 arguments (1 given)

However, window.run_command('expand_and_focus_right_pane') works fine. If I cut the class ExpandAndFocusLeftPane block and then paste it again and I try window.run_command('expand_and_focus_left_pane'), it works fine. Right now, my workaround is to

never close sublime text
If i do close sublime text accidentally, I have to go to the same file and save it again to make the plugin command work.

I would really like to get this fixed but I dont know whats going on here.

0 Likes