-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Since there isn't much documentation on what Emacs configuration looks like, I thought I'd share a few things I discovered, so that someone (hopefully me, if I can find the time) can flesh this out into a more complete config.
The only problem I had with the server itself is that lsp-mode checks the value of the "jsonrpc" attribute, which isn't set when the server replies to client messages. It isn't fatal, but causes messages to appear in the Warnings buffer for every message lsp-mode receives.
The fix is trivial (just add "jsonrpc":"2.0" to the two JSON templates in the LSP project) but it also requires updating a few tests too. If you want, I can update those and send a full PR.
This is what I have regarding the actual configuration, at least with Spacemacs:
fsharp-modewill usually run FSAC, which conflicts with the completion provided bylsp-mode. Make sure to(setq fsharp-ac-intellisense-enabled nil)prior to loadingfsharp-modeto disable FSAC.- You'll need to link in the LSP company backend as part of the
fsharp-modeload hook. With Spacemacs, the config looks like this and should probably go in yourpost-init-company:
(spacemacs|add-company-backends
:backends company-lsp
:modes fsharp-mode
:append-hooks nil
:call-hooks t)
(company-mode)- You'll also want to activate the LSP keybinds, instead of
fsharp-modekeybinds that require FSAC. With Spacemacs, you'll want to put this intoinit-fsharp-mode's:configentry:(spacemacs/lsp-bind-keys-for-mode 'fsharp-mode) - If you're using a recent LSP mode, you can define and initialize the LSP service this way. It needs to happen when you're already in
fsharp-mode, so thefsharp-modehook is a good place to run this:
(require 'lsp)
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection "FSharpLanguageServer") ;; Must be on your PATH
:major-modes '(fsharp-mode)
:server-id 'fsharp-lsp))
(lsp) ;; Auto-initializes to fsharp-lsp as long as you're in fsharp-mode