rossabaker / lsp-scala

Scala support for lsp-mode using metals
GNU General Public License v3.0
49 stars 6 forks source link

Set configuration on init #2

Open rossabaker opened 6 years ago

rossabaker commented 6 years ago
(defvar lsp-scala--config-options `(:hover (:enabled "true")))

(defun lsp-scala--set-configuration ()
  ;; TODO is this going to irritate everything but metals?
  (lsp--set-configuration `(:metals ,lsp-scala--config-options)))

(add-hook 'lsp-after-initialize-hook 'lsp-scala--set-configuration)

yields

00:45:17.305 INFO  s.m.m.MetalsServices - Configuration updated Configuration(Sbt(false,test:compile),Scalac(ScalacCompletions(false),ScalacDiagnostics(false)),Scalafmt(true,true,1.3.0,None),Scalafix(true,None),Search(true,true),Hover(false),Highlight(false),Rename(false))

I can't figure out the incantation to set hover to true.

rossabaker commented 6 years ago

Ah, like this:

(defvar lsp-scala--config-options `(:hover (:enabled t)))
olafurpg commented 6 years ago

NB, I just opened https://github.com/scalameta/metals/pull/236 to enable hover by default. It used to be disabled when hover relied on the presentation compiler but now it uses SemanticDB, the same as goto definition.

olafurpg commented 6 years ago

The VS Code plugin package.json for some reason enabled it by default so I didn't notice it was off in other clients.

rossabaker commented 6 years ago

I think I'd like to flesh this out with all the options to make it easier for people to customize. But then we might always be a step behind trying to echo metals' defaults. And I want this package to be really dumb, deferring as much as possible to lsp-mode or metals. :thinking:

coreyoconnor commented 5 years ago

Could try the route of "nil implies metal's default and nil is default". Which I've seen some emacs packages do. (What? No Option?) Would still require the schema of options to match tho.