Emacs and scala 3

I’m a long time emacs user trying out dotty/scala3. Is there a scala-mode for emacs that works with dotty’s new syntax? Another feature I would like is the ability to jump to compiler errors directly (this is possible with scala2/emacs but not with scala3/emacs yet as far as I know). Has anyone got that working? Thanks for any pointers.

1 Like

Adding the following to my .emacs file has worked for getting emacs to navigate to the compilation errors:

;; Help from: https://www.emacswiki.org/emac/CreatingYourOwnCompileErrorRegexp
(require 'compile)
      (lambda()      ;; bunch of settings for scala-mode
               ;; use re-builder to modify the following regexp (contents of the string)
               ;; if it does not match all your errors.
               '("\\[[Ee]rror\\] -- \\[E[0-9]+\\] [^:]+: \\(.+\\):\\([0-9]+\\):\\([0-9]+\\)" 1 2 3))))

Caveat: I have only compiled my source code once and found this to work. Maybe as the dotty compiler produces more errors, there will be some differences in the error format that this regexp does not match, but it matches all my current errors.

I submitted something similar here: support Dotty in compilation-error-regexp-alist by SethTisue · Pull Request #158 · hvesalai/emacs-sbt-mode · GitHub

1 Like

A pull request on emacs fixes the problem permanently for everyone. Thanks!!