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

Doesn't appear to work on OS X at all. [solved] #1

Closed ghost closed 12 years ago

ghost commented 12 years ago

Trying this a few different ways, but i cannot get this to work at all on OS X in the most recent version of ST2.

welovewordpress commented 12 years ago

Thank you for your feedback, Greg. I actually put some bugs in it while renaming things before putting it on GitHub. One problem was that I renamed the temporary file to have a .tmp instead of a .php extension, which is why phptidy.php refused to work on it.

Just to be clear about it: This plugin should work on OS X - that's what I'm developing it on.

It very likely that it does not work on Windows at this time (I doubt it would find /usr/bin/php on Windows, or will it?), but the updated version from today should be working fine on OS X and Linux.

I added some debug logging to the console as well as an error message if there was something wrong while calling the phptidy.php script. So, if there are any problems, please open the console and tell me, if there are any lines starting with 'PhpTidy:'. It should look like this:

PhpTidy: invoked on file: /Users/krok/Documents/Sublime Projects/test.php PhpTidy: file seems to be PHP PhpTidy: tmpfile written: /tmp/phptidy-sublime-buffer.php PhpTidy: calling script: "/Users/krok/Library/Application Support/Sublime Text 2/Packages/PhpTidy/wp-phptidy.php" replace "/tmp/phptidy-sublime-buffer.php" PhpTidy: tmpfile was processed and removed

welovewordpress commented 12 years ago

Ok, I finally got around reading the API and found that sublime.packages_path() gives me the path to the Packages folder - which seems to be not that easy in python itself.

Besides I found another issue when installing from GitHub: the executable bit (chmod +x) on the php script wp-phptidy.php was gone. That should be expected after zipping and unzipping, so I called the script via /usr/bin/php wp-phptidy.php - which still relies on the existence of /usr/bin/php but that should be there on OS X any Linux.

So, please try it again and let me know if it works for you.

ghost commented 12 years ago

My apologies, i thought you said you were devving it on windows.

I tried this again and it still does nothing for me. I've tried short and long files, highlighting the text, running from hotkey and from the menu, nothing seems to work at all for me.

Do you have a standard test file you are using it on?

ghost commented 12 years ago

OK, on further inspection i have a package directory issue going on where it cannot properly see my python install. This is why i should have my console panel open more often, sorry about that.