diff --git a/README.org b/README.org index 453ded598dc..0b0d5f80750 100644 --- a/README.org +++ b/README.org @@ -121,44 +121,44 @@ ~lsp-clients.el~ while others require installing additional packages which provide server specific functionality. - | Language | Language Server | Built-in | Installation command | Debugger | - |-----------------------+-------------------------------------------+----------------+----------------------------------------------------------------------------------------------------------------------+------------------------------| - | Bash | [[https://github.com/mads-hartmann/bash-language-server][bash-language-server]] | Yes | npm i -g bash-language-server | | - | C++ | [[https://github.com/MaskRay/ccls][ccls]] | [[https://github.com/MaskRay/emacs-ccls][emacs-ccls]] | [[https://github.com/MaskRay/ccls][ccls]] | Yes (gdb or lldb) | - | C++ | [[https://clang.llvm.org/extra/clangd.html][clangd]] | Yes | [[https://clang.llvm.org/extra/clangd.html][clangd]] | Yes (gdb or lldb) | - | C++ | [[https://github.com/cquery-project/cquery][cquery]] | [[https://github.com/cquery-project/emacs-cquery][emacs-cquery]] | [[https://github.com/cquery-project/cquery][cquery]] | Yes (gdb or lldb) | - | Clojure | [[https://github.com/snoe/clojure-lsp][clojure-lsp]] | Yes | [[https://github.com/snoe/clojure-lsp][clojure-lisp]] | | - | CSS/LessCSS/SASS/SCSS | [[https://github.com/vscode-langservers/vscode-css-languageserver-bin][css]] | Yes | npm install -g vscode-css-languageserver-bin | | - | Dart | [[https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md][dart_analysis_server]] | Yes | built into dart-sdk | | - | Dart | [[https://github.com/natebosch/dart_language_server][dart_language_server]] | Yes | pub global activate dart_language_server | | - | Elixir | [[https://github.com/JakeBecker/elixir-ls][elixir-ls]] | Yes | [[https://github.com/JakeBecker/elixir-ls][elixir-ls]] | Yes | - | Elm | [[https://github.com/elm-tooling/elm-language-server][elmLS]] | Yes | npm i -g @elm-tooling/elm-language-server, or clone the repository and follow installation instructions | No | - | F# | [[https://github.com/fsharp/FsAutoComplete][fsautocomplete]] | Yes | Clone the [[https://github.com/fsharp/FsAutoComplete][repository]], run ./build.sh LocalRelease. Set lsp-fsharp-server-path, and lsp-fsharp-server-runtime. | No | - | Fortran | [[https://github.com/hansec/fortran-language-server][fortran-language-server]] | Yes | pip install fortran-language-server | Yes | - | Go | [[https://golang.org/x/tools/cmd/gopls][gopls]] | Yes | [[golang.org/x/tools/cmd/gopls][gopls]] go get -u golang.org/x/tools/cmd/gopls | Yes | - | Go | [[https://github.com/saibing/bingo][bingo]] | Yes | [[https://github.com/saibing/bingo/wiki/Install][bingo]] | Yes | - | Groovy | [[https://github.com/palantir/language-servers][groovy-language-server]] | Yes | [[https://github.com/palantir/language-servers][groovy-language-server]] | | - | Hack | [[https://docs.hhvm.com/hhvm/][hhvm]] | Yes | [[https://docs.hhvm.com/hhvm/installation/introduction][hhvm]] | | - | HTML | [[https://github.com/vscode-langservers/vscode-html-languageserver][html]] | Yes | npm install -g vscode-html-languageserver-bin | | - | Haskell | [[https://github.com/haskell/haskell-ide-engine][IDE engine]] | [[https://github.com/emacs-lsp/lsp-haskell][lsp-haskell]] | [[https://github.com/haskell/haskell-ide-engine][IDE engine]] | | - | Java | [[https://github.com/eclipse/eclipse.jdt.ls][Eclipse JDT LS]] | [[https://github.com/emacs-lsp/lsp-java][lsp-java]] | Automatic by [[https://github.com/emacs-lsp/lsp-java][lsp-java]] | Yes | - | JavaScript/TypeScript | [[https://github.com/theia-ide/typescript-language-server][typescript-language-server]] (recommended) | Yes | npm i -g typescript-language-server; npm i -g typescript | Yes (Firefox/Chrome) | - | JavaScript/TypeScript | [[https://github.com/sourcegraph/javascript-typescript-langserver][javascript-typescript-stdio]] | Yes | npm i -g javascript-typescript-langserver | Yes (Firefox/Chrome) | - | JavaScript Flow | [[https://flow.org][flow]] (add-on if working on a Flow file) | Yes | [[https://flow.org][flow]] | Yes (Firefox/Chrome) | - | Julia | [[https://github.com/non-Jedi/lsp-julia][lsp-julia]] | [[https://github.com/non-Jedi/lsp-julia][lsp-julia]] | [[https://github.com/JuliaEditorSupport/LanguageServer.jl][LanguageServer.jl]] | | - | Kotlin | [[https://github.com/fwcd/KotlinLanguageServer][kotlin-language-server]] | Yes | [[https://github.com/fwcd/KotlinLanguageServer][kotlin-language-server]] | | - | Ocaml | [[https://github.com/freebroccolo/ocaml-language-server][ocaml-language-server]] | Yes | [[https://github.com/freebroccolo/ocaml-language-server][ocaml-language-server]] | | - | PHP(recommended) | [[https://github.com/bmewburn/vscode-intelephense][intelephense]] | Yes | npm i intelephense -g | Yes | - | PHP | [[https://github.com/felixfbecker/php-language-server][php-language-server]] | Yes | [[https://github.com/felixfbecker/php-language-server][php-language-server]] | Yes | - | Powershell | [[https://github.com/PowerShell/PowerShellEditorServices][PowerShellEditorServices]] | [[https://github.com/kiennq/lsp-powershell][lsp-powershell]] | Automatic by [[https://github.com/kiennq/lsp-powershell][lsp-powershell]] | | - | Python | [[https://github.com/palantir/python-language-server][pyls]] | Yes | pip install 'python-language-server[all]' | Yes | - | Python(Microsoft) | [[https://github.com/Microsoft/python-language-server][Microsoft Python Language Server]] | [[https://github.com/andrew-christianson/lsp-python-ms/][lsp-python-ms]] | [[https://github.com/andrew-christianson/lsp-python-ms/][lsp-python-ms]] | Yes | - | Ruby | [[https://github.com/castwide/solargraph][solargraph]] | Yes | gem install solargraph | Yes | - | Rust | [[https://github.com/rust-lang-nursery/rls][rls]] | Yes | [[https://github.com/rust-lang-nursery/rls][rls]] | Yes | - | Scala | [[https://scalameta.org/metals][Metals]] | Yes | [[https://scalameta.org/metals/docs/editors/emacs.html][Metals]] | | - | Swift | [[https://github.com/apple/sourcekit-lsp][sourcekit-LSP]] | [[https://github.com/emacs-lsp/lsp-sourcekit][lsp-sourcekit]] | [[https://github.com/apple/sourcekit-lsp][sourcekit-LSP]] | Yes (via llvm debug adapter) | - | Vue | [[https://github.com/vuejs/vetur/tree/master/server][vue-language-server]] | Yes | npm install -g vue-language-server | Yes (Firefox/Chrome) | - | XML | [[https://github.com/angelozerr/lsp4xml][lsp4xml]] | Yes | Download from [[https://github.com/angelozerr/lsp4xml/releases][lsp4xml releases]] | | + | Language | Language Server | Built-in | Installation command | Debugger | + |-----------------------+--------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+------------------------------| + | Bash | [[https://github.com/mads-hartmann/bash-language-server][bash-language-server]] | Yes | npm i -g bash-language-server | | + | C++ | [[https://github.com/MaskRay/ccls][ccls]] | [[https://github.com/MaskRay/emacs-ccls][emacs-ccls]] | [[https://github.com/MaskRay/ccls][ccls]] | Yes (gdb or lldb) | + | C++ | [[https://clang.llvm.org/extra/clangd.html][clangd]] | Yes | [[https://clang.llvm.org/extra/clangd.html][clangd]] | Yes (gdb or lldb) | + | C++ | [[https://github.com/cquery-project/cquery][cquery]] | [[https://github.com/cquery-project/emacs-cquery][emacs-cquery]] | [[https://github.com/cquery-project/cquery][cquery]] | Yes (gdb or lldb) | + | Clojure | [[https://github.com/snoe/clojure-lsp][clojure-lsp]] | Yes | [[https://github.com/snoe/clojure-lsp][clojure-lisp]] | | + | CSS/LessCSS/SASS/SCSS | [[https://github.com/vscode-langservers/vscode-css-languageserver-bin][css]] | Yes | npm install -g vscode-css-languageserver-bin | | + | Dart | [[https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md][dart_analysis_server]] | Yes | built into dart-sdk | | + | Dart | [[https://github.com/natebosch/dart_language_server][dart_language_server]] | Yes | pub global activate dart_language_server | | + | Elixir | [[https://github.com/JakeBecker/elixir-ls][elixir-ls]] | Yes | [[https://github.com/JakeBecker/elixir-ls][elixir-ls]] | Yes | + | Elm | [[https://github.com/elm-tooling/elm-language-server][elmLS]] | Yes | npm i -g @elm-tooling/elm-language-server, or clone the repository and follow installation instructions | No | + | F# | [[https://github.com/fsharp/FsAutoComplete][fsautocomplete]] | Yes | Automatic by [[https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-fsharp.el][lsp-fsharp]] | No | + | Fortran | [[https://github.com/hansec/fortran-language-server][fortran-language-server]] | Yes | pip install fortran-language-server | Yes | + | Go | [[https://golang.org/x/tools/cmd/gopls][gopls]] | Yes | [[golang.org/x/tools/cmd/gopls][gopls]] go get -u golang.org/x/tools/cmd/gopls | Yes | + | Go | [[https://github.com/saibing/bingo][bingo]] | Yes | [[https://github.com/saibing/bingo/wiki/Install][bingo]] | Yes | + | Groovy | [[https://github.com/palantir/language-servers][groovy-language-server]] | Yes | [[https://github.com/palantir/language-servers][groovy-language-server]] | | + | Hack | [[https://docs.hhvm.com/hhvm/][hhvm]] | Yes | [[https://docs.hhvm.com/hhvm/installation/introduction][hhvm]] | | + | HTML | [[https://github.com/vscode-langservers/vscode-html-languageserver][html]] | Yes | npm install -g vscode-html-languageserver-bin | | + | Haskell | [[https://github.com/haskell/haskell-ide-engine][IDE engine]] | [[https://github.com/emacs-lsp/lsp-haskell][lsp-haskell]] | [[https://github.com/haskell/haskell-ide-engine][IDE engine]] | | + | Java | [[https://github.com/eclipse/eclipse.jdt.ls][Eclipse JDT LS]] | [[https://github.com/emacs-lsp/lsp-java][lsp-java]] | Automatic by [[https://github.com/emacs-lsp/lsp-java][lsp-java]] | Yes | + | JavaScript/TypeScript | [[https://github.com/theia-ide/typescript-language-server][typescript-language-server]] (recommended) | Yes | npm i -g typescript-language-server; npm i -g typescript | Yes (Firefox/Chrome) | + | JavaScript/TypeScript | [[https://github.com/sourcegraph/javascript-typescript-langserver][javascript-typescript-stdio]] | Yes | npm i -g javascript-typescript-langserver | Yes (Firefox/Chrome) | + | JavaScript Flow | [[https://flow.org][flow]] (add-on if working on a Flow file) | Yes | [[https://flow.org][flow]] | Yes (Firefox/Chrome) | + | Julia | [[https://github.com/non-Jedi/lsp-julia][lsp-julia]] | [[https://github.com/non-Jedi/lsp-julia][lsp-julia]] | [[https://github.com/JuliaEditorSupport/LanguageServer.jl][LanguageServer.jl]] | | + | Kotlin | [[https://github.com/fwcd/KotlinLanguageServer][kotlin-language-server]] | Yes | [[https://github.com/fwcd/KotlinLanguageServer][kotlin-language-server]] | | + | Ocaml | [[https://github.com/freebroccolo/ocaml-language-server][ocaml-language-server]] | Yes | [[https://github.com/freebroccolo/ocaml-language-server][ocaml-language-server]] | | + | PHP(recommended) | [[https://github.com/bmewburn/vscode-intelephense][intelephense]] | Yes | npm i intelephense -g | Yes | + | PHP | [[https://github.com/felixfbecker/php-language-server][php-language-server]] | Yes | [[https://github.com/felixfbecker/php-language-server][php-language-server]] | Yes | + | Powershell | [[https://github.com/PowerShell/PowerShellEditorServices][PowerShellEditorServices]] | [[https://github.com/kiennq/lsp-powershell][lsp-powershell]] | Automatic by [[https://github.com/kiennq/lsp-powershell][lsp-powershell]] | | + | Python | [[https://github.com/palantir/python-language-server][pyls]] | Yes | pip install 'python-language-server[all]' | Yes | + | Python(Microsoft) | [[https://github.com/Microsoft/python-language-server][Microsoft Python Language Server]] | [[https://github.com/andrew-christianson/lsp-python-ms/][lsp-python-ms]] | [[https://github.com/andrew-christianson/lsp-python-ms/][lsp-python-ms]] | Yes | + | Ruby | [[https://github.com/castwide/solargraph][solargraph]] | Yes | gem install solargraph | Yes | + | Rust | [[https://github.com/rust-lang-nursery/rls][rls]] | Yes | [[https://github.com/rust-lang-nursery/rls][rls]] | Yes | + | Scala | [[https://scalameta.org/metals][Metals]] | Yes | [[https://scalameta.org/metals/docs/editors/emacs.html][Metals]] | | + | Swift | [[https://github.com/apple/sourcekit-lsp][sourcekit-LSP]] | [[https://github.com/emacs-lsp/lsp-sourcekit][lsp-sourcekit]] | [[https://github.com/apple/sourcekit-lsp][sourcekit-LSP]] | Yes (via llvm debug adapter) | + | Vue | [[https://github.com/vuejs/vetur/tree/master/server][vue-language-server]] | Yes | npm install -g vue-language-server | Yes (Firefox/Chrome) | + | XML | [[https://github.com/angelozerr/lsp4xml][lsp4xml]] | Yes | Download from [[https://github.com/angelozerr/lsp4xml/releases][lsp4xml releases]] | | ** Commands - ~lsp-describe-session~ - Display session folders and running servers. - ~lsp-describe-thing-at-point~ - Display help for the thing at point. diff --git a/lsp-fsharp.el b/lsp-fsharp.el index d205388c821..d67dcdf238b 100644 --- a/lsp-fsharp.el +++ b/lsp-fsharp.el @@ -41,11 +41,20 @@ (const :tag "Use .Net Framework" 'net-framework)) :package-version '(lsp-mode . "6.1")) -(defcustom lsp-fsharp-server-path nil - "The path to fsautocomplete." +(defcustom lsp-fsharp-server-install-dir (locate-user-emacs-file "fsautocomplete/") + "Install directory for fsautocomplete server. +The slash is expected at the end." :group 'lsp-fsharp :risky t - :type 'file + :type 'directory + :package-version '(lsp-mode . "6.1")) + +(defcustom lsp-fsharp-server-download-url "https://ci.appveyor.com/api/projects/fsautocomplete/fsautocomplete/artifacts/bin/pkgs/fsautocomplete.netcore.zip?branch=master" + "Fsautocomplete download url. +To use the mono/.Net framework version, set this to \"https://ci.appveyor.com/api/projects/fsautocomplete/fsautocomplete/artifacts/bin/pkgs/fsautocomplete.zip?branch=master\"" + :group 'lsp-fsharp + :risky t + :type 'string :package-version '(lsp-mode . "6.1")) (defcustom lsp-fsharp-server-args nil @@ -57,15 +66,39 @@ (defun lsp-fsharp--fsac-runtime-cmd () "Get the command required to run fsautocomplete based off of the current runtime." (pcase lsp-fsharp-server-runtime - ('net-core '("dotnet")) - ('mono '("mono")) + ('net-core "dotnet") + ('mono "mono") ('net-framework nil))) +(defun lsp-fsharp--fsac-cmd () + "The location of fsautocomplete executable." + (let ((file-ext (if (eq lsp-fsharp-server-runtime 'net-core) + ".dll" + ".exe"))) + (expand-file-name (concat "fsautocomplete" file-ext) lsp-fsharp-server-install-dir))) + +(defun lsp-fsharp--fsac-locate () + "Return the location of the fsautocomplete langauge server." + (let ((fsac (lsp-fsharp--fsac-cmd))) + (unless (file-exists-p fsac) + (if (yes-or-no-p "Server is not installed. Do you want to install it?") + (lsp-fsharp--fsac-install) + (error "LSP F# cannot be started without FsAutoComplete Server"))) + fsac)) + +(defun lsp-fsharp--fsac-install () + "Downloads the latest version of fsautocomplete, and set `lsp-fsharp-server-path'." + (let* ((temp-file (make-temp-file "fsautocomplete" nil ".zip")) + (unzip-script (cond ((executable-find "unzip") "bash -c 'mkdir -p %2$s && unzip -qq %1$s -d %2$s'") + ((executable-find "powershell") "powershell -noprofile -noninteractive -nologo -ex bypass Expand-Archive -path '%s' -dest '%s'") + (t (user-error "Unable to unzip server - file %s cannot be extracted, please extract it manually" temp-file))))) + (url-copy-file lsp-fsharp-server-download-url temp-file t) + (shell-command (format unzip-script temp-file (expand-file-name lsp-fsharp-server-install-dir))) + (shell-command (format "%s %s --version" (lsp-fsharp--fsac-runtime-cmd) (lsp-fsharp--fsac-cmd))))) + (defun lsp-fsharp--make-launch-cmd () "Build the command required to launch fsautocomplete." - (unless lsp-fsharp-server-path (lsp-warn "Cannot locate fsautocomplete")) - (append (lsp-fsharp--fsac-runtime-cmd) - (list lsp-fsharp-server-path "--mode" "lsp") + (append (list (lsp-fsharp--fsac-runtime-cmd) (lsp-fsharp--fsac-locate) "--mode" "lsp" "--background-service-enabled") lsp-fsharp-server-args)) (defun lsp-fsharp--make-init-options () @@ -77,6 +110,7 @@ :major-modes '(fsharp-mode) :notification-handlers (ht ("fsharp/notifyCancel" #'ignore) ("fsharp/notifyWorkspace" #'ignore) + ("fsharp/fileParsed" #'ignore) ("fsharp/notifyWorkspacePeek" #'ignore)) :initialization-options 'lsp-fsharp--make-init-options :server-id 'fsac))