diff --git a/modules/lang/fsharp/README.org b/modules/lang/fsharp/README.org index b4d2874ec..a11f9502e 100644 --- a/modules/lang/fsharp/README.org +++ b/modules/lang/fsharp/README.org @@ -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. diff --git a/modules/lang/fsharp/config.el b/modules/lang/fsharp/config.el index f56000a1c..071585737 100644 --- a/modules/lang/fsharp/config.el +++ b/modules/lang/fsharp/config.el @@ -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)))