Skip to content

Commit

Permalink
Merge pull request #7 from SandeepVRao/master
Browse files Browse the repository at this point in the history
Context entry and Syntax Validation
  • Loading branch information
jason-kane committed May 19, 2015
2 parents 52f39c4 + 99ac2bf commit 4ef22b0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Context.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"id": "yapf",
"caption": "PyYapf: Reformat Python",
"command": "yapf"
}
]
15 changes: 15 additions & 0 deletions PyYapf.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,18 @@ def run(self, edit):
self.view.show_at_center(region)

print('PyYapf Completed')

def is_visible(self):
fName = self.view.file_name()
vSettings = self.view.settings()
syntaxPath = vSettings.get('syntax')
syntax = ""
ext = ""

if (fName != None): # file exists, pull syntax type from extension
ext = os.path.splitext(fName)[1][1:]
if(syntaxPath != None):
syntax = os.path.splitext(syntaxPath)[0].split('/')[-1].lower()

return ext == 'py' or "Python" in syntax

0 comments on commit 4ef22b0

Please sign in to comment.