Sublime Forum

Conditional Context Menus?

#1

Is it possible to create conditional context menus, specifically on tab context menus? For example based on the file extension, or partial path matching?

Thanks in advance!

0 Likes

#2

For the command, you can define an is_visible method. Return True if you want the method to appear in the context menu, return False if not.

0 Likes

#3

Yes! That was exactly what I needed. I can’t believe I missed that. Thank you! :smile:

0 Likes

#4

Can you give an example of how to implement this method?

I’m a bit of a Sublime theme noob. But would like to create a simple theme for my students that just lights up the folders in a Rails app: For example the “Model” folder might have a yellow background, and the “View” might have a blue background. I think that would be helpful for teaching!

Thanks so much.

0 Likes

#5

Hi castig, it sounds like you want to conditionally color the side bar. As far as I know, that isn’t possible in ST. msinclar’s question is aimed at conditionally showing menu options.

0 Likes

#6

Thanks for explaining @skuroda

I posted a feature request for an “educational theme” with conditional themeing here:
sublimetext.userecho.com/topic/216947-/

If you like it vote it up! Thanks so much

0 Likes