jcberquist / sublimetext-cfml

CFML (ColdFusion and Lucee) package for Sublime Text
MIT License
115 stars 24 forks source link

[Feature Request] Integrate cfscript.me to convert tags to cfscript #73

Closed cybersonic closed 6 years ago

cybersonic commented 7 years ago

cfscript.me is a great resource by @pfreitag that would be great to add to the plugin so you can convert selections or whole files.

pfreitag commented 7 years ago

Hey guys I also just released a commandbox command for it - might be able to integrate with that

jcberquist commented 7 years ago

@pfreitag Your commandbox command currently only works on whole files, correct? It is relatively easy to run a box command on the current file by adding a build system entry for it. For example you could create a cfscriptme.sublime-build file in your ST User package folder with the following contents:

{
    "shell_cmd": "box cfscriptme sourcePath=\"$file_name\" force=true",
    "selector": "embedding.cfml"
}

Then when a CFML file is open you can use CTRL+SHIFT+B to call up the build menu and select cfscriptme. This will work on the entire contents of the current file. Unfortunately it can be very slow to execute as it has the overhead of starting the box binary each time.

What about posting to your cfscript.me api endpoint? Is that doable, and are you comfortable with that approach? (I have no idea if and how much traffic that might generate.) I suspect going that route would be faster and would have the added benefit of allowing for the conversion of selections rather than having to do it on whole files. But I certainly understand you might not want that.

Long term I would like to figure out how to open and maintain a box shell session via ST so that commands could be run without having to start the box binary each time. I think that is doable, but I haven't had time to look into it. I certainly don't want to do it incorrectly and start bringing down ST users' machines.

pfreitag commented 7 years ago

@jcberquist This is probably something that I could open up an API for in the future, but in the near term I think the local execution route is preferable.

jcberquist commented 7 years ago

@pfreitag Makes sense to me, thanks. @cybersonic so for now I would recommend adding a build system entry to your user package folder, and maybe down the road I can do something more comprehensive.

Thom1729 commented 7 years ago

As it happens, I wrote a Sublime command that does the same thing a while back. It has advantages and disadvantages compared to sublime.me. If native Sublime integration is a sticking point, this command might be of use.

jcberquist commented 7 years ago

@Thom1729: If you want to contribute it, I would happily include it in this package. Or you could submit it to Package Control directly. Either way, I think it would be great to make it available.