spacemacs/layers/+tools/tree-sitter
Elliott Shugerman 2462c05528 [tree-sitter] use global ts-fold modes
This is possible now since https://github.com/emacs-tree-sitter/ts-fold/issues/3
has been resolved.
2023-01-01 15:09:00 +01:00
..
README.org chore(ts-fold): Update repo link for ts-fold module (#15719) 2022-09-02 04:37:35 -04:00
config.el chore: update copyright headers to 2022 2022-06-03 17:32:20 +02:00
funcs.el [tree-sitter] add option to seletively disable tree sitter hl mode (#15317) 2022-02-12 05:25:01 +00:00
packages.el [tree-sitter] use global ts-fold modes 2023-01-01 15:09:00 +01:00

README.org

tree-sitter layer

Description

This layer integrates Emacs Tree-sitter">Emacs Tree-sitter and a few packages built around it. An Emacs build supporting dynamic modules is required.

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.

Features:

  • Syntax highlighting
  • Indentation (experimental)
  • Folding (experimental)

Install

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.

Configure

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 tree-sitter-mode">tree-sitter-mode. Default: t.

Set tree-sitter-indent-enable t for code indentation, provided by tree-sitter-indent">tree-sitter-indent. Currently only Rust is supported. Default: nil.

Set tree-sitter-fold-enable t for code folding, provided by 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.

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.

  (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))