Home Download Buy Blog Forum Support

.sublime-menu when specifix syntax(es)

.sublime-menu when specifix syntax(es)

Postby PhilippSchaffrath on Sat Mar 10, 2012 10:31 pm

Hey guys,

i am kind of confused of the sublime-menus. I want to display a button IF the current syntax is "Packages/PHP/PHP.tmLanguage", is there a way to define this in the sublime-menu file?

Thats my file so far:
Code: Select all
[
    {
        "caption":"Instant Execute",
        "children":
        [
            {
               "command": "instant_execute",
               "caption": "PHP"
            }
        ]
    }
]


Hope there is a Solution for this!

Regards, Philipp
PhilippSchaffrath
 
Posts: 17
Joined: Sat Mar 10, 2012 1:24 pm

Re: .sublime-menu when specifix syntax(es)

Postby tito on Sun Mar 11, 2012 6:12 am

Code: Select all
class InstantExecuteCommand(sublime_plugin.WindowCommand):
   def run(self):
      ..something..

   def is_visible(self):
      view = sublime.active_window().active_view()
      if view:
         return view.settings().get('syntax') == 'Packages/PHP/PHP.tmLanguage'
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 706
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: .sublime-menu when specifix syntax(es)

Postby PhilippSchaffrath on Sun Mar 11, 2012 10:25 am

This is awesome, thank you verry much!
PhilippSchaffrath
 
Posts: 17
Joined: Sat Mar 10, 2012 1:24 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 4 guests