lsp-scala icon indicating copy to clipboard operation
lsp-scala copied to clipboard

Set configuration on init

Open rossabaker opened this issue 6 years ago • 5 comments

(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 avatar Apr 04 '18 04:04 rossabaker

Ah, like this:

(defvar lsp-scala--config-options `(:hover (:enabled t)))

rossabaker avatar Apr 04 '18 05:04 rossabaker

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 avatar Apr 04 '18 08:04 olafurpg

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

olafurpg avatar Apr 04 '18 08:04 olafurpg

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:

rossabaker avatar Apr 13 '18 01:04 rossabaker

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.

coreyoconnor avatar Dec 19 '18 17:12 coreyoconnor