Metals: Add installation instructions for Emacs

Created on 9 Dec 2018  路  12Comments  路  Source: scalameta/metals

I would love to update the website to document the installation instructions for Emacs using lsp-scala (https://github.com/rossabaker/lsp-scala/). I've been planning to do this for awhile but I have limited experience with Emacs so I got stuck on my first attempt and never got around to finish it.

cc/ @rossabaker

documentation

Most helpful comment

I wrote extensive Learning Emacs docs over at

that you may wish to use for your own benefit.

All 12 comments

Would someone be able to help out with this? I've spent a couple hours trying to get lsp-scala working on my computer but I've never used Emacs before so it's all new to me.

The benefit of documenting the Emacs installation on the Metals website is that version numbers for generating the metals-emacs binary will stay up-to-date as new releases are published.

cc/ @coreyoconnor

Alternatively, if someone can give me a pointers on how to get started from a completely clean ~/.emacs.d then I'd love to give it another try myself. I struggled most with installing packages.

I wrote extensive Learning Emacs docs over at

that you may wish to use for your own benefit.

@fommil thanks, I got it working!

Whoops, fat thumb closed the issue while I was writing a response.

It's a little more burdensome than it ought to be because the package isn't in MELPA yet, like its dependency. I did some of the ceremonial linting to get it up to standard. I'll try to submit it to MELPA today.

I like how Emacs highlights the line that you navigate to

2018-12-10 12 27 47

I'll open a PR soon updating the docs. The integration is not perfect yet, I can't get lsp-mode to send the correct shutdown and exit hooks. It also sends textDocument/hover requests even if Metals does not declare a hover provider. Those can be improved on in the future.

@rossabaker would it be possible to enable the hook by default?

(add-hook 'scala-mode-hook #'lsp-scala-enable)

I'm not aware of another editor that require enabling the language server on a file-basis. It's more common to disable/enable the LSP package on per-project.

@rossabaker what do you mean "like its dependency"? https://melpa.org/#/lsp-mode

@olafurpg btw, just so you know, the red squiggly support is already provided, (non-ensime) emacs by sbt's lsp and/or flycheck. I suspect the docs may need to touch on disabling things or everybody is going to get conflicts and perf regressions. Spacemacs often enables stuff by default.

That's a very good point, We do the same for VSCode's docs, for other available Scala LSP extensions, so it makes sense for Emacs too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fommil picture fommil  路  3Comments

FereX98 picture FereX98  路  4Comments

tanishiking picture tanishiking  路  4Comments

olafurpg picture olafurpg  路  4Comments

iokacha picture iokacha  路  4Comments