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

Python 3 + ST3 support, fixes #18 #21

Closed Geczy closed 11 years ago

sergeevabc commented 11 years ago

@Geczy, what commands should I use to download/apply this commit over git-cloned repo?

Geczy commented 11 years ago

https://github.com/Geczy/SublimePhpTidy/archive/master.zip

sergeevabc commented 11 years ago

@Geczy, you've made changes to one file only, is there a way to get that only file by means of "Git for Windows"?

Geczy commented 11 years ago

No idea, I don't use that software

Here's the one file only: https://raw.github.com/Geczy/SublimePhpTidy/05ff1d058aeb79f476398d41b4f2130a0d8a3298/php_tidy.py

sergeevabc commented 11 years ago

@Geczy, right. It works for me, thanks.

welovewordpress commented 11 years ago

@Geczy I'm afraid your version still doesn't work on my ST3 (on OS X).

But I'm going to merge it anyway as it seems to work for the two of you.

Geczy commented 11 years ago

@welovewordpress What does ST3 console say when you try? Any errors?

wp-lab commented 11 years ago

@Geczy the issue seems to exist only if there are Unicode characters present in the php code.

Try to add an € symbol to your code - or any other unicode character and the console will show:

PhpTidy: Ok, this seems to be PHP
PhpTidy: buffer written to tmpfile: /tmp/phptidy-sublime-buffer.php
PhpTidy: calling script: /usr/bin/php "/Users/krok/Library/Application Support/Sublime Text 3/Packages/PhpTidy/wp-phptidy.php" replace "/tmp/phptidy-sublime-buffer.php"
Traceback (most recent call last):
  File "/Applications/Sublime Text 3.app/Contents/MacOS/sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "/Users/krok/Library/Application Support/Sublime Text 3/Packages/PhpTidy/php_tidy.py", line 73, in run
    newContent = fileHandle.read()
  File "X/encodings/ascii.py", line 26, in decode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 14: ordinal not in range(128)

I think that might be because you have removed the .decode('utf-8') fromt the last line... but I'm no good with python so if anyone would like to help with this I would greatly appreciate it.

kind regards,

Matt

StefsterNYC commented 10 years ago

Boy, they don't make it easy to load this. I downloaded that mater one but it says for ST2 not 3. Am I reading that wrong?