Best way to create Sublime CoffeeCompile equivalent for jetbrain IDEs?

Hi, in short, recently seen a CoffeeCompile plugin for sublime text editor in action. Loved how it allows to select some coffeescript code and using a shortcut to see to what javascript will be compiled out of it.
And in short I need advice or help with making something like that for PyCharm.

More details.
Here is python code for that plugin
https://github.com/surjikal/sublime-coffee-compile/blob/master/coffee_compile.py

So it takes selected text, starts coffeescript compiler as a sub process with stdin on and just write selected text in to that process, after which reads output and you see it in a new window or something.

Coffescript compiler has –eval option that allows to compile one coffescript line like that:
coffee -bpe "alert 'hello world'"

Sadly I did not find a way to exploit that one because of one line limitation and some other problems

Then there is –stdio argument which is actually used in that Sublime plugin, and it seems to me to be a more correct way, I just am not sure from where to start with running coffee in –stdio mode and sending selected text in to it, and then outputting result in to console.
4 comments
Comment actions Permalink
You could select one or several lines of CoffeeScript code, call the context menu and select item "Preview Compiled CoffeeScript File"
0
Comment actions Permalink
I know, sadly its not as useful as that Sublime CoffeeCombile plugin, compiled file shows whole file which I can see in browser anyways, seeing only selected lines helps with debugging or and learning. With large file with many classes and other code seeing whole file is inconvenient.
Currently I am ending up with copying selected lines by hand to other file to see only them compiled when I need this, which is far from perfect.
Seems I will need to explore how to make plugins for PyCharm to achieve that.
0
Comment actions Permalink
Eduard, with PyCharm you could compile only selected fragment of CoffeeScript code. Just call context menu on selected code
0
Comment actions Permalink
Ok, need to update more often, it indeed does work like that in last version. Wonder when it was added.
0

Please sign in to leave a comment.