Permalink
Browse files

Fixed bugs. Added PHP 5.5 compat mode

  • Loading branch information...
1 parent 29acc03 commit 22c88bfe19913c6d26664114b59b344ad719336e @akalongman committed Jan 28, 2016
View
@@ -41,12 +41,12 @@ def plugin_loaded():
settings = sublime.load_settings('CodeFormatter.sublime-settings')
debug_mode = settings.get('codeformatter_debug', False)
- if debug_mode:
+ #if debug_mode:
#from pprint import pprint
#pprint(settings)
- debug_write("Debug mode enabled")
- debug_write("Platform "+sublime.platform()+" "+sublime.arch())
- debug_write("Sublime Version "+sublime.version())
+ #debug_write("Debug mode enabled")
+ #debug_write("Platform "+sublime.platform()+" "+sublime.arch())
+ #debug_write("Sublime Version "+sublime.version())
#debug_write("Settings "+pprint(settings))
@@ -6,6 +6,7 @@
"syntaxes": "php", // Syntax names which must process PHP formatter
"php_path": "", // Path for PHP executable, e.g. "/usr/lib/php" or "C:/Program Files/PHP/php.exe". If empty, uses command "php" from system environments
"format_on_save": false, // Format on save
+ "php55_compat": false, // PHP 5.5 compatible mode
"psr1": false, // Activate PSR1 style
"psr1_naming": false, // Activate PSR1 style - Section 3 and 4.3 - Class and method names case
"psr2": true, // Activate PSR2 style
@@ -158,7 +159,7 @@
"middle_tags": "^(Else|ElseIf .* Then|Case .*)$", // List of keywords which divide a block, but neither open or close the block
"closing_tags": "(End Function|End Sub|End If|Next|Loop|End Select)$" // List of keywords which close an open block
},
-
+
"codeformatter_coldfusion_options":
{
"syntaxes": "coldfusion,cfm,cfml", // Syntax names which must process Coldfusion Markup Language formatter
@@ -170,7 +171,7 @@
"max_preserve_newlines": 10, // Maximum number of line-breaks to be preserved in one chunk
"indent_tags": "html|head|body|div|nav|ul|ol|dl|li|table|thead|tbody|tr|th|td|blockquote|select|form|option|optgroup|fieldset|legend|label|header|section|aside|footer|figure|video|cfapplet|cfapplication|cfassociate|cfauthenticate|cfcache|cfcol|cfcollection|cfcontent|cfdirectory|cferror|cfexecute|cfexit|cffile|cfform|cfftp|cffunction|cfgrid|cfgridcolumn|cfgridrow|cfgridupdate|cfheader|cfhtmlhead|cfhttp|cfif|cfindex|cfinput|cfldap|cflocation|cflock|cfloop|cfmail|cfmodule|cfobject|cfoutput|cfpop|cfprocparam|cfprocresult|cfquery|cfreport|cfrethrow|cfschedule|cfscript|cfsearch|cfselect|cfservlet|cfsetting|cfsilent|cfslider|cfstoredproc|cfswitch|cfcase|cfdefaultcase|cftable|cftextinput|cftransaction|cftree|cftry|cfcatch|cfsavecontent", // List of tags (defaults to indent) that should be reformatted. Example "div|p|li|table"
"middle_tags" : "cfelse|cfelseif"
- },
+ }
}
Binary file not shown.
@@ -22,6 +22,10 @@ def format(self, text):
if ("php_path" in self.opts and self.opts["php_path"]):
php_path = self.opts["php_path"]
+ php55_compat = False
+ if ("php55_compat" in self.opts and self.opts["php55_compat"]):
+ php55_compat = self.opts["php55_compat"]
+
enable_auto_align = False
if ("enable_auto_align" in self.opts and self.opts["enable_auto_align"]):
enable_auto_align = self.opts["enable_auto_align"]
@@ -30,7 +34,6 @@ def format(self, text):
if ("indent_with_space" in self.opts and self.opts["indent_with_space"]):
indent_with_space = self.opts["indent_with_space"]
-
psr1 = False
if ("psr1" in self.opts and self.opts["psr1"]):
psr1 = self.opts["psr1"]
@@ -63,7 +66,10 @@ def format(self, text):
cmd = []
cmd.append(str(php_path))
- cmd.append(sublime.packages_path()+"/CodeFormatter/codeformatter/lib/phpbeautifier/fmt.phar")
+ if php55_compat:
+ cmd.append(sublime.packages_path()+"/CodeFormatter/codeformatter/lib/phpbeautifier/fmt.8.9.0.phar")
+ else:
+ cmd.append(sublime.packages_path()+"/CodeFormatter/codeformatter/lib/phpbeautifier/fmt.phar")
if psr1:
cmd.append("--psr1")
@@ -94,13 +100,17 @@ def format(self, text):
if len(excludes) > 0:
cmd.append("--exclude="+','.join(excludes))
- cmd.append("--dry-run")
+ if not php55_compat:
+ cmd.append("--dry-run")
+
cmd.append("--no-backup")
cmd.append("-")
stderr = ""
stdout = ""
+ print(cmd)
+
try:
if (self.formatter.platform == "windows"):
startupinfo = subprocess.STARTUPINFO()
View
@@ -0,0 +1,9 @@
+Sublime CodeFormatter 3.1.0 Changelog:
+
+Please report me any bugs and proposals at akalongman@gmail.com or GitHub (https://github.com/akalongman/sublimetext-codeformatter/issues)
+
+Changelog
+------------
+- Added support for PHP 5.5 (php55_compat)
+- Improved coldfusion formatter
+- Fixed comma bug in settings file

0 comments on commit 22c88bf

Please sign in to comment.