piuccio / sublime-esformatter

JavaScript formatter plugin for Sublime Text
MIT License
28 stars 20 forks source link

Do not include esformatter #65

Closed nicolai86 closed 8 years ago

nicolai86 commented 8 years ago

Bundling esformatter leads to all sorts of problems when the user wants to use different plugins. Instead, assume the user has esformatter installed globally via npm install -g esformatter.

This means esformatter can be updated without updating this plugin, and it also means the user can configure esformatter more freely using .esformatter file.

piuccio commented 8 years ago

I like the idea, I need more time to review it. I see that it creates a temp file. Does it work when you have multiple selections?

Thanks for the PR

nicolai86 commented 8 years ago

@piuccio I played around with it - everything seems to work. Multiple regions, single regions, entire file.

piuccio commented 8 years ago

The code throws an exception on Windows + ST3, it might be related to path and backward slash, I don't have a fix yet, hopefully I have more time later

nicolai86 commented 8 years ago

@piuccio thanks for the first feedback. I've updated the code accordingly. Sadly I only have OS X + ST3 at hand, so I can only guess at why it crashes on windows, same as you.

nicolai86 commented 8 years ago

@piuccio I had to remove the tempfile usage, it turns out the esformatter takes input from STDIN, too. It turns out the tempfile wasn't used, instead the code passed to communicate was being used.

piuccio commented 8 years ago

I finally had some time to test it on Windows, works fine. Thanks for the PR

nicolai86 commented 8 years ago

:+1:

holm commented 8 years ago

Would be lovely with a release of this!

piuccio commented 8 years ago

Yeah, I had an issue with my mac + sublime 3 so I've decided to postpone until I can investigate better. If you've got the same setup you can try installing from master branch and let me know if it works fine for you. This multi platform is a nightmare

holm commented 8 years ago

I just tried it. I had to use https://github.com/int3h/SublimeFixMacPath to get it to pick up esformatter automatically. Unfortunately it no longer seems that it picks up the project roots .esformatter file, so the formatting is done using the defaults.

Not sure if I am doing something wrong, or the path fixer is the cause of it, but I never had problems with it before.