2015-12-02 14:23:39 +00:00
#+TITLE : F# layer
2015-06-10 16:44:30 +00:00
2019-05-07 08:53:56 +00:00
#+TAGS : general|layer|multi-paradigm|programming
2019-05-05 17:26:40 +00:00
2015-06-10 16:44:30 +00:00
[[file:img/fsharp.png ]]
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description ][Description ]]
2018-01-07 22:26:54 +00:00
- [[#features ][Features: ]]
2017-05-22 14:16:12 +00:00
- [[#install ][Install ]]
2020-11-09 21:21:30 +00:00
- [[#configuration ][Configuration ]]
- [[#choosing-a-backend ][Choosing a backend ]]
- [[#eglot ][Eglot ]]
- [[#lsp ][LSP ]]
2018-12-05 03:03:03 +00:00
- [[#key-bindings ][Key bindings ]]
2017-05-22 14:16:12 +00:00
- [[#repl ][REPL ]]
2015-06-10 16:44:30 +00:00
* Description
2018-01-07 22:26:54 +00:00
This layer adds support for F# language using [[https://github.com/fsharp/fsharpbinding ][fsharpbinding ]] and [[https://github.com/fsharp/fsharpbinding ][fsharp-mode ]].
2015-06-10 16:44:30 +00:00
2018-01-07 22:26:54 +00:00
** Features:
2020-11-09 21:21:30 +00:00
- Auto-completion
- Syntax-checking
2018-01-07 22:26:54 +00:00
- Syntax highlighting
- REPL
2016-04-13 03:31:38 +00:00
2015-06-10 16:44:30 +00:00
* Install
2016-01-06 05:21:55 +00:00
To use this configuration layer, add it to your =~/.spacemacs= . You will need to
2020-11-09 21:21:30 +00:00
add =fsharp= to the existing =dotspacemacs-configuration-layers= list in this file.
In addition you require the .NET Core executable in your path.
* Configuration
All layer configurations can be done by setting layer variables in your dotfile.
No custom user config lines are necessary
** Choosing a backend
This layer provides two alternative backends to choose from.
*** Eglot
This is the default choice if nothing is set and no lsp layer
is loaded in your dotfile. This mode provides straight forward
IDE capabilities by means of an external server using the LSP
protocol using =eglot-mode= a lightweight LSP client.
The server is started automatically when a fsharp file is
opened.
This backend is best used if small applications are edited.
To set explicitly set the following in your dotfile:
#+BEGIN_SRC emacs-lisp
(fsharp :variables fsharp-backend 'eglot)
#+END_SRC
*** LSP
For proper IDE support this backend should be used. It is
also based on an external LSP server however it is using a
more elaborate client providing a lot of standard feature
which are not available by the lightweight alternative.
The server is started automatically when a fsharp file is
opened. The key bindings are the same for all lsp modes
so if you are already familiar with one you should be
able to work the same in all modes.
To set explicitly do the following in your dotfile:
#+BEGIN_SRC emacs-lisp
(fsharp :variables
fsharp-backend 'lsp)
#+END_SRC
Normally LSP mode should install the matching server for
you if you require a specific version you need to install it
yourself from [[https://github.com/fsharp/FsAutoComplete ][here ]].
NOTE: Key bindings for LSP are defined in the
LSP layer. Also it is advisable to have a look
at the autocomplete layer for an optimal
intellisense config for LSP.
2015-06-10 16:44:30 +00:00
2018-12-05 03:03:03 +00:00
* Key bindings
2015-06-10 16:44:30 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2015-06-10 16:44:30 +00:00
|-------------+----------------------------|
2015-06-12 01:23:07 +00:00
| ~SPC m c c~ | Build the project |
2020-11-09 21:21:30 +00:00
| ~SPC m g a~ | Go to alternate file |
2015-06-10 16:44:30 +00:00
** REPL
2020-11-09 21:21:30 +00:00
| Key binding | Description |
|--------------------------+------------------------------------------------------------------|
| ~SPC m s b~ | Send buffer to the REPL |
| ~SPC m s B~ | Send buffer to the REPL and switch to the REPL in =insert state= |
| ~SPC m s i~ or ~SPC m '~ | Start a REPL |
| ~SPC m s p~ | Send phrase to the REPL |
| ~SPC m s P~ | Send phrase to the REPL and switch to the REPL in =insert state= |
| ~SPC m s r~ | Send region to the REPL |
| ~SPC m s R~ | Send region to the REPL and switch to the REPL in =insert state= |