You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/emacs-tree-sitter.org
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,7 @@ The variable ~tree-sitter-load-path~ is a list of directories that the function
167
167
(tree-sitter-require 'rust)
168
168
#+end_src
169
169
170
+
*** tree-sitter-langs
170
171
The package ~tree-sitter-langs~ is a language bundle that contains shared libraries for some languages (as well as syntax highlighting queries). When it is loaded, its shared libraries are prioritized over the CLI's directory.
171
172
172
173
Syntax-aware language-agnostic mechanisms are meant to be defined by ~tree-sitter-mode~ and its dependent minor modes. They determine the language object to use by consulting the variable ~tree-sitter-major-mode-language-alist~. This list is empty by default, and gets populated by ~tree-sitter-langs~ when it is loaded, and by language major modes that are ~tree-sitter~-aware.
@@ -191,7 +192,7 @@ If, for some reason, you cannot update, the older binaries can be downloaded fro
191
192
:EXPORT_TITLE: Syntax Highlighting
192
193
:END:
193
194
194
-
Syntax highlighting is provided by the minor mode ~tree-sitter-hl-mode~. It overrides the regex-based highlighting provided by ~font-lock-mode~, using the syntax tree provided by ~tree-sitter-mode~. It is based on [[* Queries][*tree queries*]], a system for pattern-matching on Tree-sitter's syntax trees.
195
+
The minor mode ~tree-sitter-hl-mode~ provides the framework for syntax highlighting. It overrides the regex-based highlighting provided by ~font-lock-mode~, using the syntax tree provided by ~tree-sitter-mode~. It is based on [[* Queries][*tree queries*]], a system for pattern-matching on Tree-sitter's syntax trees.
195
196
196
197
It can be toggled in a buffer by the command ~tree-sitter-hl-mode~, or enabled through major mode hooks:
197
198
#+begin_src emacs-lisp
@@ -203,6 +204,11 @@ To enable it whenever possible (assuming the language major modes were already i
Like ~font-lock-mode~, ~tree-sitter-hl-mode~ provides only the mechanisms. The actual highlighting rules are provided by language-specific packages, or a language bundle like ~tree-sitter-langs~.
210
+
{{% /notice %}}
211
+
206
212
*** tree-sitter-langs
207
213
The package ~tree-sitter-langs~ provides syntax highlighting [[https://github.com/emacs-tree-sitter/tree-sitter-langs/tree/master/queries][queries]] for some languages.
0 commit comments