/julia-ts-mode

Experimental Emacs Julia major mode using tree-sitter

Primary LanguageEmacs LispMIT LicenseMIT

Julia major mode using tree-sitter

Emacs major mode for the Julia programming language using tree-sitter for font-lock, indentation, imenu, and navigation. It is derived from julia-mode.

Installation

Dependencies

This package requires:

  1. Emacs 29 or newer built with tree-sitter support;
  2. Julia tree-sitter grammar; and
  3. The package julia-mode.

Installation from MELPA

julia-ts-mode is available on MELPA. The recommended way to install it is using use-package. The following code installs julia-ts-mode and selects it as the default major mode for Julia files:

(use-package julia-ts-mode
  :ensure t
  :mode "\\.jl$")

Installation from source

You can install this package from source by cloning this directory and adding the following lines to your Emacs configuration:

(add-to-list 'load-path "<path to the source-code tree>")
(require 'julia-ts-mode)

LSP Configuration

This mode is derived from julia-mode. Hence, most of the feature available for it will also work in julia-ts-mode. However, the LSP requires additional configuration. First, it is necessary to install the package lsp-julia, and apply the desired configuration as stated in its documentation. Afterward, add the following code to your Emacs configuration file:

(add-to-list 'lsp-language-id-configuration '(julia-ts-mode . "julia"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection 'lsp-julia--rls-command)
                 :major-modes '(julia-mode ess-julia-mode julia-ts-mode)
                 :server-id 'julia-ls
                 :multi-root t))