welovewordpress / SublimePhpTidy

Plugin for Sublime Text 2 to format PHP code to meet the WordPress Coding Standards using a modified version of phptidy
GNU General Public License v2.0
109 stars 30 forks source link

Tidy unsaved buffer #17

Open Mallinanga opened 11 years ago

Mallinanga commented 11 years ago

I think it would be a great addition to be able to tidy a php file that hasn't been saved yet. Now when i try to tidy an unsaved buffer in ST2 i get the following error in console:

PhpTidy: invoked on file: None Traceback (most recent call last): File "./sublime_plugin.py", line 362, in run_ File "./php_tidy.py", line 12, in run File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.py", line 95, in splitext return genericpath._splitext(p, sep, altsep, extsep) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/genericpath.py", line 91, in _splitext sepIndex = p.rfind(sep) AttributeError: 'NoneType' object has no attribute 'rfind'

essenmitsosse commented 9 years ago

I am getting exactly the same error message, the problem is: the file is already saved.

PhpTidy: invoked on file: None
Traceback (most recent call last):
  File "./sublime_plugin.py", line 362, in run_
  File "./php_tidy.py", line 12, in run
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.py", line 95, in splitext
    return genericpath._splitext(p, sep, altsep, extsep)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/genericpath.py", line 91, in _splitext
    sepIndex = p.rfind(sep)
AttributeError: 'NoneType' object has no attribute 'rfind'`