Skip to content

Commit

Permalink
Merge pull request #25 from predragnikolic/enable-command-for-php-sco…
Browse files Browse the repository at this point in the history
…pe-only

Check if the command should run
  • Loading branch information
adael authored Jul 7, 2018
2 parents 782b2d2 + 36fbf97 commit 3f628c3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions SublimePhpCsFixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ def get_project_folder(file):


class SublimePhpCsFixCommand(sublime_plugin.TextCommand):
def is_enabled(self):
return self.is_supported_scope(self.view)

def run(self, edit):
try:
log_to_console("Formatting view...")
Expand All @@ -227,6 +230,9 @@ def run(self, edit):
except ExecutableNotFoundException as e:
log_to_console(str(e))

def is_supported_scope(self, view):
return 'embedding.php' in view.scope_name(self.view.sel()[0].begin())


class SublimePhpCsFixListener(sublime_plugin.EventListener):
def on_pre_save(self, view):
Expand Down

0 comments on commit 3f628c3

Please sign in to comment.