jcf-cli icon indicating copy to clipboard operation
jcf-cli copied to clipboard

Communication via StdIn/StdOut

Open Wosi opened this issue 7 years ago • 3 comments

I'd like to start a separate VSCode extension (entirely open source) that will use jcf-cli. Right now, jcf-cli reads a file from the filesystem, formats its contents and writes it back.

That's not the best solution for a code formatter running in the background of a code editor. Biggest drawback is the fact that jcf-cli is unable to format dirty files.

That's why I would like to send the current file content via StdIn to jcf-cli and expect to get the formatted result returned in StdOut.

That way we could format dirty files without running into conflicts with the editor.

Wosi avatar Aug 14 '18 21:08 Wosi

We can solve the communication part. But making JCF to be able to work on dirty codes is another problem. I'm afraid we can't do it without rewriting many parts of JCF itself. By doing so, we separate this CLI version too far from the original JCF. Something that I'm not ready to do.

pakLebah avatar Aug 15 '18 00:08 pakLebah

When I say "dirty files" I'm talking about files with unsaved modifications in the editor. I'm aware of the problem with code that can't be parsed.

Just focus on the communication part. I'm going to publish a proof-of-concept-extension here on GitHub that would work with the new version of jcf-cli.

Wosi avatar Aug 15 '18 07:08 Wosi

Ah, sorry. I thought "dirty files" mean "dirty codes" because that's the main problem of JCF.

Sounds great. Will see your new experimental extension utilizing jcf-cli. Although actually I hope you will work on code outline enhancement. 😊

pakLebah avatar Aug 15 '18 12:08 pakLebah