hvesalai / emacs-scala-mode

The definitive scala-mode for emacs
http://ensime.org
GNU General Public License v3.0
362 stars 68 forks source link

compile mode with sbt thin client #165

Closed fommil closed 3 years ago

fommil commented 3 years ago

no need for sbt-mode for me with this. I use it like this

(use-package scala-mode
  :mode ((rx (| ".scala" ".sbt") eos) . scala-mode)
  :config
  (require 'scala-compile) ;; not needed if this PR is merged because it is auto-loaded
  (bind-key "C-c c" #'scala-compile scala-mode-map))

and individual files can specify a preferred command to override the default (user-configurable) history, e.g. this at the end

// Local Variables:
// scala-compile-suggestion: "sbtn runMain foo.bar.Main"
// End:

folk that don't have sbtn can change the defaults to sbt --client, and it should also pave the way for maven / gradle / fury / whatever.

fommil commented 3 years ago

This needs a function to spin up a server. I thought it did that automatically but apparently not. It can come in a follow up.

Looks like the server isn't staying up when called from emacs, it's a bug in sbtn https://github.com/sbt/sbt/issues/6271

fommil commented 3 years ago

@hvesalai ok I made the changes, and fixed some things.

fommil commented 3 years ago

@hvesalai upstream changes to sbt have been merged, I think I've finished this PR now.

hvesalai commented 3 years ago

Any tips on what I need to do to test this?

fommil commented 3 years ago

if your project is using the latest sbt you should be able to just type M-x scala-compile from any scala buffer. Change the command from sbtn to sbt --client if you don't want to install any extra software but if you want the full experience then also install sbtn using the instructions in the header.

fommil commented 3 years ago

If you want to go the full hog, we could set up an automated testing rig like https://gitlab.com/tseenshe/haskell-tng.el/-/blob/tng/test/haskell-tng-compile-test.el but that would be a lot of effort at this point.

fommil commented 3 years ago

https://eed3si9n.com/sbt-1.4.7 is released; everything should work fine and dandy with it.