lang/julia: improve lsp support (#4012)

* lang/julia: include lsp-julia w/o language server

Use nonrecursive clone to get lsp-julia without bundled
LanguageServer.jl (plus dependencies) and include instructions in the
README on how to install the language server (bundled or otherwise).

* lang/julia: add checks for julia +lsp in doctor

Add two checks, both only for when the +lsp feature is enabled:
- Check if (:tools lsp) is selected
- Check if LanguageServer.jl is installed

* lang/julia: indicate SymbolServer.jl as dependency

It is itself a dependency of LanguageServer.jl, but it's necessary to
add it separately in order to do `using SymbolServer`.

* tools/lsp: add julia language server to list

* lang/julia: add eglot support using eglot-jl

Forcing eglot-jl to not install its own LanguageServer.jl is a bit of a
hack though.

* lang/julia: make timeout increase buffer-local

Suggestion by @benneti to use `setq-local` instead of `setq` to prevent
a timeout increase in non-Julia eglot buffers.

* Fix issues

Co-authored-by: Henrik Lissner <henrik@lissner.net>
This commit is contained in:
Han 2021-03-02 04:25:35 +01:00 committed by GitHub
parent 88e18fc7c1
commit ba0f791b05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 26 deletions

View file

@ -65,10 +65,26 @@
(term-set-escape-char ?\C-c)))
(when (featurep! +lsp)
(add-hook 'julia-mode-local-vars-hook #'lsp!))
(use-package! lsp-julia
:when (featurep! +lsp)
:unless (featurep! :tools lsp +eglot)
:after lsp-mode
:preface
(setq lsp-julia-default-environment "~/.julia/environments/v1.0")
(when (featurep! +lsp)
(add-hook 'julia-mode-local-vars-hook #'lsp!)))
(setq lsp-julia-default-environment "~/.julia/environments/v1.0"))
(use-package! eglot-jl
:when (featurep! +lsp)
:when (featurep! :tools lsp +eglot)
:after eglot
:preface
;; Prevent auto-install of LanguageServer.jl
(setq eglot-jl-language-server-project "~/.julia/environments/v1.0")
:init
;; Prevent timeout while installing LanguageServer.jl
(setq-hook! 'julia-mode-hook eglot-connect-timeout (max eglot-connect-timeout 60))
:config (eglot-jl-init))