2022-01-02 06:53:20 +00:00
|
|
|
#+TITLE: tree-sitter layer
|
|
|
|
|
2022-01-08 11:55:37 +00:00
|
|
|
#+TAGS: layer|tool
|
2022-01-02 06:53:20 +00:00
|
|
|
|
2022-01-02 06:54:20 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2022-01-02 06:53:20 +00:00
|
|
|
- [[#description][Description]]
|
|
|
|
- [[#features][Features:]]
|
|
|
|
- [[#install][Install]]
|
|
|
|
- [[#configure][Configure]]
|
|
|
|
|
|
|
|
* Description
|
2022-01-02 06:54:20 +00:00
|
|
|
This layer integrates [[https://github.com/emacs-tree-sitter/elisp-tree-sitter][=Emacs Tree-sitter=]] and a few packages built around it.
|
|
|
|
An Emacs build supporting dynamic modules is required.
|
2022-01-02 06:53:20 +00:00
|
|
|
|
2022-01-02 06:54:20 +00:00
|
|
|
Language (i.e. major-mode) support is somewhat limited and varies by feature.
|
|
|
|
Refer to the README/documentation of the package providing the feature for
|
|
|
|
specifics.
|
2022-01-02 06:53:20 +00:00
|
|
|
|
|
|
|
** Features:
|
2022-01-02 06:54:20 +00:00
|
|
|
- Syntax highlighting
|
|
|
|
- Indentation (experimental)
|
|
|
|
- Folding (experimental)
|
2022-01-02 06:53:20 +00:00
|
|
|
|
|
|
|
* Install
|
2022-01-02 06:54:20 +00:00
|
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need
|
|
|
|
to add =tree-sitter= to the existing =dotspacemacs-configuration-layers= list
|
|
|
|
in this file.
|
2022-01-02 06:53:20 +00:00
|
|
|
|
|
|
|
* Configure
|
2022-01-02 06:54:20 +00:00
|
|
|
*Note*: Enabled features /should/ override existing mechanisms seamlessly. For example,
|
|
|
|
there's no need to separately disable regexp-based syntax highlighting, and in
|
|
|
|
general you do not need to update key bindings to point to new tree-sitter-based
|
|
|
|
commands.
|
|
|
|
|
|
|
|
Set =tree-sitter-syntax-highlight-enable t= for syntax highlighting, provided
|
|
|
|
by =tree-sitter-hl-mode= which is bundled with [[https://github.com/emacs-tree-sitter/elisp-tree-sitter][=tree-sitter-mode=]].
|
|
|
|
Default: =t=.
|
|
|
|
|
|
|
|
Set =tree-sitter-indent-enable t= for code indentation, provided by
|
|
|
|
[[https://codeberg.org/FelipeLema/tree-sitter-indent.el][=tree-sitter-indent=]]. Currently only Rust is supported.
|
|
|
|
Default: =nil=.
|
|
|
|
|
|
|
|
Set =tree-sitter-fold-enable t= for code folding, provided by [[https://github.com/jcs090218/ts-fold][=ts-fold=]]. If
|
|
|
|
you use a =dotspacemacs-editing-style= other than ='vim= or a
|
|
|
|
=dotspacemacs-folding-method= other than ='evil=, it's likely that you'll find
|
|
|
|
the integration with =ts-fold= wanting. Contributions are encouraged!
|
|
|
|
Default: =nil=.
|
2022-02-12 05:25:01 +00:00
|
|
|
|
|
|
|
Set =spacemacs-tree-sitter-hl-black-list= for a list of modes that should
|
|
|
|
not enable highlight by =tree-sitter-hl-mode=, such as
|
|
|
|
=js2-mode= and =rjsx-mode= for example.
|
|
|
|
|
|
|
|
#+begin_src elisp
|
|
|
|
(setq-default dotspacemacs-configuration-layers
|
|
|
|
(tree-sitter :variables
|
|
|
|
spacemacs-tree-sitter-hl-black-list '(js2-mode rjsx-mode)
|
|
|
|
tree-sitter-syntax-highlight-enable t
|
|
|
|
tree-sitter-fold-enable t
|
|
|
|
tree-sitter-fold-indicators-enable nil))
|
|
|
|
#+end_src
|