Merge pull request #1540 from TOTBWF/lsp-fsharp

lang/fsharp: add LSP support
This commit is contained in:
Henrik Lissner 2019-07-05 20:11:04 +02:00 committed by GitHub
commit b07c047068
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 8 deletions

View file

@ -12,6 +12,7 @@
- [[#mono][Mono]]
- [[#osx][OSX]]
- [[#arch-linux][Arch Linux]]
- [[#lsp][LSP]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#troubleshooting][Troubleshooting]]
@ -28,22 +29,25 @@ This module adds [[https://fsharp.org/][F#]] support.
+ Syntax checking
** Module Flags
This module provides no flags.
+ =+lsp= Enables lsp-fsharp (this requires ~:tools lsp~ to be enabled).
** Plugins
+ [[https://github.com/fsharp/emacs-fsharp-mod+e][fsharp-mode]]
+ =+lsp=
+ [[https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-fsharp.el][lsp-fsharp]]
** Hacks
None so far.
* Prerequisites
** Mono
To get code completion/syntax checking, you will need to install [[https://www.mono-project.com/][mono]].
To get code completion/syntax checking when not using lsp, you will need to install [[https://www.mono-project.com/][mono]].
*** OSX
Do *NOT* install mono via brew. See this [[https://github.com/fsharp/FsAutoComplete/issues/331][issue]].
*** Arch Linux
#+BEGIN_SRC sh
sudo pacman -S mono
#+END_SRC
** LSP
The language server is automatically installed by [[https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-fsharp.el][lsp-fsharp]].
* Features
An in-depth list of features, how to use them, and their dependencies.

View file

@ -1,14 +1,20 @@
;;; lang/fsharp/config.el -*- lexical-binding: t; -*-
(after! fsharp-mode
(setq fsharp-ac-use-popup nil) ; Use a buffer for docs rather than a pop-up
(set-lookup-handlers! 'fsharp-mode :async t :definition #'fsharp-ac/gotodefn-at-point)
(set-company-backend! 'fsharp-mode 'fsharp-ac/company-backend)
(if (featurep! +lsp)
(progn
(setq fsharp-ac-intellisense-enabled nil)
(setq lsp-fsharp-server-install-dir (concat doom-etc-dir "fsautocomplete/"))
(add-hook 'fsharp-mode-local-vars-hook #'lsp!))
(setq fsharp-ac-use-popup nil) ; Use a buffer for docs rather than a pop-up
(set-lookup-handlers! 'fsharp-mode :async t :definition #'fsharp-ac/gotodefn-at-point)
(set-company-backend! 'fsharp-mode 'fsharp-ac/company-backend))
(set-repl-handler! 'fsharp-mode #'run-fsharp)
(map! :localleader
:map fsharp-mode-map
"b" #'fsharp-ac/pop-gotodefn-stack ; Useful for re-tracing your steps
"e" #'fsharp-eval-region
"l" #'fsharp-load-buffer-file
"q" #'fsharp-ac/stop-process
"t" #'fsharp-ac/show-tooltip-at-point))
(:unless (featurep! +lsp)
"q" #'fsharp-ac/stop-process
"t" #'fsharp-ac/show-tooltip-at-point)))