Code formatting feature
Closed this issue · 4 comments
poslegm commented
derekwyatt commented
I dunno if you'd want to spawn a JVM every time you wanted to format a file; this is something that is far more appropriate for SBT to do, IMHO. At any rate, I probably won't be writing this one, but if someone has a decent implementation, a PR would be fine.
poslegm commented
Oh, while writing this issue I relied on my experience with a scalafmt-intellij plugin which works very fast. But I missed out that Intellij plugin just call scalafmt functions from already running JVM.
I measured the launch time of scalafmt-cli and it will obviously annoy the user 😒
In this case, I see no reason to keep this issue open.
ches commented
poslegm commented
Eventually I achive it in the following way:
- vim-autoformat plugin with config
let g:formatdef_scalafmt = "'scalafmt --stdin'"
let g:formatters_scala = ['scalafmt']
- scalafmt built with GraalVM. GraalVM allows instant scalafmt CLI launch:
scalafmt --help 0,01s user 0,02s system 15% cpu 0,199 total
But without GraalVM it is unviable idea.