2020-04-08 14:33:27 -06:00
|
|
|
#+TITLE: lang/julia
|
|
|
|
#+DATE: April 8, 2020
|
2021-03-02 04:25:35 +01:00
|
|
|
#+SINCE: v1.3
|
2020-04-08 14:33:27 -06:00
|
|
|
#+STARTUP: inlineimages nofold
|
|
|
|
|
|
|
|
* Table of Contents :TOC_3:noexport:
|
|
|
|
- [[#description][Description]]
|
|
|
|
- [[#module-flags][Module Flags]]
|
|
|
|
- [[#plugins][Plugins]]
|
|
|
|
- [[#prerequisites][Prerequisites]]
|
|
|
|
- [[#language-server][Language Server]]
|
2021-03-02 04:25:35 +01:00
|
|
|
- [[#lsp-julia][~lsp-julia~]]
|
|
|
|
- [[#eglot-jl][~eglot-jl~]]
|
2020-04-08 14:52:45 -06:00
|
|
|
- [[#features][Features]]
|
|
|
|
- [[#language-server-1][Language Server]]
|
2020-04-08 14:33:27 -06:00
|
|
|
- [[#configuration][Configuration]]
|
2021-03-02 04:25:35 +01:00
|
|
|
- [[#change-the-default-environment-for-the-julia-language-server][Change the default environment for the Julia language server]]
|
2020-04-08 14:33:27 -06:00
|
|
|
|
|
|
|
* Description
|
2021-03-02 04:25:35 +01:00
|
|
|
This module adds support for [[https://julialang.org/][the Julia language]] to Doom Emacs.
|
2020-04-08 14:33:27 -06:00
|
|
|
|
|
|
|
+ Syntax highlighting and latex symbols from ~julia-mode~
|
|
|
|
+ REPL integration from ~julia-repl~
|
|
|
|
+ Code completion and syntax checking, requires ~:tools lsp~ and ~+lsp~
|
|
|
|
|
|
|
|
** Module Flags
|
2021-03-02 04:25:35 +01:00
|
|
|
+ =+lsp= Enable LSP server support.
|
|
|
|
|
2020-04-08 14:33:27 -06:00
|
|
|
** Plugins
|
|
|
|
+ [[https://github.com/tpapp/julia-repl][julia-mode]]
|
|
|
|
+ [[https://github.com/JuliaEditorSupport/julia-emacs/][julia-repl]]
|
|
|
|
+ =+lsp= and =:tools lsp=
|
2021-03-02 04:25:35 +01:00
|
|
|
+ [[https://github.com/non-jedi/lsp-julia][lsp-julia]]
|
2020-04-08 14:33:27 -06:00
|
|
|
+ [[https://github.com/emacs-lsp/lsp-mode][lsp]]
|
2021-03-02 04:25:35 +01:00
|
|
|
+ =+lsp= and =:tools lsp +eglot=
|
|
|
|
+ [[https://github.com/non-jedi/eglot-jl][eglot-jl]]
|
|
|
|
+ [[https://github.com/joaotavora/eglot][eglot]]
|
2020-04-08 14:33:27 -06:00
|
|
|
|
|
|
|
* Prerequisites
|
2021-03-02 04:25:35 +01:00
|
|
|
This module requires =julia= and an language server if =+lsp= is enabled.
|
2020-04-08 14:33:27 -06:00
|
|
|
|
2020-04-08 14:52:45 -06:00
|
|
|
** Language Server
|
2021-03-02 04:25:35 +01:00
|
|
|
~+lsp~ requires ~LanguageServer.jl~ and ~SymbolServer.jl~. The =lsp-julia= and
|
|
|
|
=eglot-jl= packages both come bundled with their own versions of these servers,
|
|
|
|
which is used by default. If you're happy with that, no further configuration is
|
|
|
|
necessary.
|
|
|
|
|
|
|
|
However, to use your own installation you will need to install then configure
|
|
|
|
them. To install them, execute these commands in a Julia REPL:
|
|
|
|
|
|
|
|
#+BEGIN_SRC julia
|
|
|
|
using Pkg
|
|
|
|
Pkg.add("LanguageServer")
|
|
|
|
Pkg.add("SymbolServer")
|
|
|
|
#+END_SRC
|
2020-04-08 14:52:45 -06:00
|
|
|
|
2021-03-02 04:25:35 +01:00
|
|
|
Then configure =lsp-julia= or =eglot-jl= depending on whether you have enabled
|
|
|
|
=:tools lsp= or =:tools (lsp +eglot)=, respectively:
|
|
|
|
|
|
|
|
*** ~lsp-julia~
|
|
|
|
To instruct =lsp-julia= not to use the built-in package:
|
2020-04-08 14:52:45 -06:00
|
|
|
|
|
|
|
#+BEGIN_SRC elisp
|
2021-03-02 04:25:35 +01:00
|
|
|
;; ~/.doom.d/config.el
|
|
|
|
(setq lsp-julia-package-dir nil)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
To find your installation of ~LanguageServer.jl~, ~eglot-jl~ needs to know the
|
|
|
|
environment in which it is installed. This is set to v1.0 by default as it is
|
|
|
|
the current LTS:
|
|
|
|
|
|
|
|
#+BEGIN_SRC elisp
|
|
|
|
(setq lsp-julia-default-environment "~/.julia/environments/v1.0")
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** ~eglot-jl~
|
|
|
|
To find your installation of ~LanguageServer.jl~, ~eglot-jl~ must know the
|
|
|
|
environment in which it is installed. This is set to v1.0 by default as it is
|
|
|
|
the current LTS:
|
|
|
|
|
|
|
|
#+BEGIN_SRC elisp
|
|
|
|
;; ~/.doom.d/config.el
|
|
|
|
(setq eglot-jl-language-server-project "~/.julia/environments/v1.0")
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
But to let ~eglot-jl~ use the environment bundled with it, set it to
|
|
|
|
~eglot-jl-base~ instead:
|
|
|
|
|
|
|
|
#+BEGIN_SRC elisp
|
|
|
|
;; ~/.doom.d/config.el
|
|
|
|
(after! eglot-jl
|
|
|
|
(setq eglot-jl-language-server-project eglot-jl-base))
|
2020-04-08 14:52:45 -06:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-04-08 14:33:27 -06:00
|
|
|
* Features
|
|
|
|
** Language Server
|
2021-03-02 04:25:35 +01:00
|
|
|
~+lsp~ adds code completion, syntax checking, formatting and other ~lsp-mode~ or
|
|
|
|
~eglot~ features. It requires ~LanguageServer.jl~, the installation of which is
|
|
|
|
described above.
|
|
|
|
|
2020-04-08 14:33:27 -06:00
|
|
|
* Configuration
|
2021-03-02 04:25:35 +01:00
|
|
|
** Change the default environment for the Julia language server
|
2020-04-08 15:01:25 -06:00
|
|
|
~lsp-julia~ requires a variable be set for the Julia environment. This is set to
|
|
|
|
v1.0 by default as it is the current LTS.
|
2020-04-08 14:33:27 -06:00
|
|
|
|
|
|
|
#+BEGIN_SRC elisp
|
|
|
|
;; ~/.doom.d/config.el
|
|
|
|
(setq lsp-julia-default-environment "~/.julia/environments/v1.0")
|
|
|
|
#+END_SRC
|