jcberquist / commandbox-cfformat

A CommandBox module for formatting CFML component files.
MIT License
22 stars 10 forks source link

Any plans to make this into an editor plugin? #43

Open sbleon opened 5 years ago

sbleon commented 5 years ago

This is kind of an absurd request, since you've already built a Sublime Text plugin for formatting CFML, but I was wondering if there are any plans to make this new engine available as an editor plugin.

I'm interested in this because we're working on setting up command-line code formatting, but we also really like the "just format the selected code" capability of your ST plugin. We'd rather not use both formatters, because even with the same author, it seems like the output isn't always going to be exactly the same. We'd also prefer to have a single configuration for both the CLI and editor-based formatter.

Let me know your thoughts. Thanks so much for building all of these great tools!

jcberquist commented 5 years ago

This is a good question. I am not sure of the answer right now. I don't really like trying to maintain the two formatters in parallel, but for now I am in something of a holding pattern with the ST one as I try to get the CLI tool into a usable state. As you say, right now that means that the formatting produced by the ST formatter and this tool do not match. Long term, I would definitely like to use the same configuration file format for both (if I try to keep both). But until the settings get into a more finalized state I hesitate to do that. Additionally, I still use Sublime Text and I know that a new dev cycle is going to start relatively soon, possibly with some significant changes, so I would like to wait and see what changes before I work on the ST side of things. Sorry I can't be more precise - but for sure long term I plan to use the same configuration files and format for both, and hopefully get the produced formatting to be the same.

Rodel30 commented 3 years ago

I think there is a way to configure ST3 to execute a command in a shell post-save of a file. If so, a small package that does that could be a bridge (user could install this formatter, but not use the watcher and instead have their editor trigger formatting on save)

sbleon commented 3 years ago

The startup delay of running box cfformat each time a file changes would lead to a poor developer experience, in my opinion. It takes almost 5s on my workstation, and I personally don't want to see my files being changed 5s after I save them. You really want it to feel instantaneous.

On Wed, Sep 1, 2021 at 10:57 AM Isaiah Fischer @.***> wrote:

I think there is a way to configure ST3 to execute a command in a shell post-save of a file. If so, a small package that does that could be a bridge (user could install this formatter, but not use the watcher and instead have their editor trigger formatting on save)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jcberquist/commandbox-cfformat/issues/43#issuecomment-910367167, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQQNZJSTOSIMG6FKXPWQ3T7Y5M5ANCNFSM4I5HCPBQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jcberquist commented 3 years ago

I think the solution I would try for now is to use the https://packagecontrol.io/packages/Terminus package to start a CommandBox shell "inside" of ST. Then I would create a plugin that would use the terminus_send_string command to send a cfformat run {filePath} command to that running shell on save. This would avoid the overhead of launching a shell each time.

KrunchMuffin commented 2 years ago

any movement on this? more for the vscode side, not ST.

sfeldkamp commented 2 years ago

I would like to add that this probably should intercept the save event, instead of running after the save event occurs. That's because file watchers like TestBox might be waiting to run. If cfformat re-saves the file then TestBox will likely run twice, unless it is configured with a long delay. Any delays configured in the workflow negatively effect developer experience.

I realize this is probably a lot harder to accomplish since cfformat only accepts a file path and not content.