Sublime Forum

Side bar menu

#1

Hi all,

How can I add side bar menu(when I right click on file) only for files or only for folders? For example if I add this code to “Side Bar.sublime-menu”:

{ "caption": "New command", "command": "my_command", "args": {"files": ]} }

I will get new option for all files and folders in sidebar.

How I can add this option only for files?

0 Likes

#2

Visibility is controlled by the is_visible method of the command. You can examine which items are selected in the side bar and return true/false depending on whether or not to show your command. Something like:

def is_visible(self, paths=]):
	for path in paths:
		if os.path.isfile(path):
			return True
	return False
0 Likes