Sublime Forum

Sidebar returns an empty array

#1

I’m working on a custom plugin right now that I want to hook into the sidebar. Right now, I think everything is set up properly; however, when I click on a file/folder, I get an empty array with no data. Below is my code:

class CrxdeOpenFolderCommand(sublime_plugin.WindowCommand):
	def run(self, files):
		print("Open Folder")
		print(files)
	def is_visible(self, files):
		print("Is Visible")
		print(files)
		return True

Also, here’s my Side Bar.sublime-menu:


	{ "caption": "-", "id": "crxde_commands" },
	{ "caption": "Update From CRXDE", "command": "crxde_open_folder", "args": {"files": ]} },
	{ "caption": "-", "id": "end" },
]

BTW, I created a new Side Bar.sublime-menu as opposed to hacking the one in the default package. Again, it seems like it’s working as my print() calls execute in console, but I have empty arrays getting passed into my methods – and I’ve confirmed this by seeing errors when trying to access an index within the array. Any ideas on what I could be missing?

0 Likes

#2

I found out what the problem was. Apparently, instead of using files, I should have used paths for the args in Side Bar.sublime-menu. So, it should look like this now:


   { "caption": "-", "id": "crxde_commands" },
   { "caption": "Update From CRXDE", "command": "crxde_open_folder", "args": {"paths": ]} },
   { "caption": "-", "id": "end" },
]

Just in case someone else comes across this problem.

0 Likes