Julia:added LSP and repl buffername uses workspace

This commit is contained in:
AlexLewandowski 2020-04-08 14:33:27 -06:00
parent 439562e526
commit b2368527d3
3 changed files with 81 additions and 1 deletions

View file

@ -0,0 +1,50 @@
#+TITLE: lang/julia
#+DATE: April 8, 2020
#+SINCE: {replace with next tagged release version}
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#language-server][Language Server]]
- [[#configuration][Configuration]]
* Description
Adds Julia support to Doom Emacs
+ 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
+ =+lsp= Language Server Protocol support
** Plugins
+ [[https://github.com/tpapp/julia-repl][julia-mode]]
+ [[https://github.com/JuliaEditorSupport/julia-emacs/][julia-repl]]
+ =+lsp= and =:tools lsp=
+ [[https://github.com/non-jedi/lsp-julia][lsp-julia]]
+ [[https://github.com/emacs-lsp/lsp-mode][lsp]]
* Prerequisites
This module has no direct prerequisites.
* Features
# An in-depth list of features, how to use them, and their dependencies.
** Language Server
~lsp-julia~ comes with an installation of ~LanguageServer.jl~ currently compatible with Julia v1.0.5 (current LTS) and Julia v1.3.
* Configuration
~lsp-julia~ requires a variable be set for the Julia environment. This is set to v1.0 by default.
#+BEGIN_SRC elisp
;; ~/.doom.d/config.el
(setq lsp-julia-default-environment "~/.julia/environments/v1.0")
#+END_SRC
If you would like to use your own installation of ~LanguageServer.jl~, put the following in your personal ~config.el~.
#+BEGIN_SRC elisp
;; ~/.doom.d/config.el
(setq lsp-julia-package-dir nil)
#+END_SRC

View file

@ -1,9 +1,17 @@
;;; lang/julia/config.el -*- lexical-binding: t; -*- ;;; lang/julia/config.el -*- lexical-binding: t; -*-
(use-package! julia-mode (use-package! julia-mode
:interpreter "julia" :interpreter "julia"
:config :config
(when (featurep! +lsp)
(add-hook 'julia-mode-hook #'lsp!)
(setq lsp-julia-default-environment "~/.julia/environments/v1.0")
)
(set-repl-handler! 'julia-mode #'+julia/open-repl) (set-repl-handler! 'julia-mode #'+julia/open-repl)
(add-hook 'julia-mode-hook #'julia-repl-mode)
;; Borrow matlab.el's fontification of math operators ;; Borrow matlab.el's fontification of math operators
;; From <https://ogbe.net/emacsconfig.html> ;; From <https://ogbe.net/emacsconfig.html>
@ -31,4 +39,23 @@
(after! julia-repl (after! julia-repl
(add-hook 'julia-repl-hook #'julia-repl-use-emacsclient)) (add-hook 'julia-repl-hook #'julia-repl-use-emacsclient)
(defadvice! julia-repl--buffer-name (&optional executable-key suffix)
:override #'julia-repl--inferior-buffer-name
"Name for a Julia REPL inferior buffer. Uses workspace name for doom emacs"
(concat julia-repl-inferior-buffer-name-base ":" (+workspace-current-name)))
(set-popup-rule! "^\\*julia.*\\*$" :ttl nil)
(defadvice! after-julia-repl-advice (inferior-buffer)
:after #'julia-repl--setup-term
(with-current-buffer inferior-buffer
(term-set-escape-char ?\C-c) ; override default of C-x..
))
)
(use-package! lsp-julia
:when (featurep! +lsp)
:after lsp-clients
)

View file

@ -3,3 +3,6 @@
(package! julia-mode :pin "1c122f1dff") (package! julia-mode :pin "1c122f1dff")
(package! julia-repl :pin "5fa04de4e7") (package! julia-repl :pin "5fa04de4e7")
(when (featurep! +lsp)
(package! lsp-julia :recipe (:host github :repo "non-jedi/lsp-julia") :pin "9f158a2"))