diff options
| author | Juanma Barranquero | 2022-11-22 04:40:49 +0100 |
|---|---|---|
| committer | Juanma Barranquero | 2022-11-22 04:40:49 +0100 |
| commit | ea73fd69f0c6251ad9b8fc8267ce0fa68495715e (patch) | |
| tree | e0631740c8aef46d68080214f6bbf2900fa8a996 /admin | |
| parent | 19954da8dd927f9db4ca95d8a1320207e6c404cd (diff) | |
| download | emacs-ea73fd69f0c6251ad9b8fc8267ce0fa68495715e.tar.gz emacs-ea73fd69f0c6251ad9b8fc8267ce0fa68495715e.zip | |
; Fix typos in tree-sitter files
* admin/notes/tree-sitter/starter-guide (Font-lock)
(Debugging queries, Indent, Navigation, Which-func)
(More features?):
* lisp/treesit.el (treesit--merge-ranges)
(treesit-font-lock-feature-list, treesit-font-lock-rules)
(treesit-font-lock-fontify-region, treesit--font-lock-notifier)
(treesit-simple-indent-presets, treesit--font-lock-fast-mode)
(treesit--indent-region-batch-size)
(treesit--indent-rules-optimize, treesit-ready-p): Fix typos.
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/notes/tree-sitter/starter-guide | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/admin/notes/tree-sitter/starter-guide b/admin/notes/tree-sitter/starter-guide index faf40bc64fe..123dabd9f29 100644 --- a/admin/notes/tree-sitter/starter-guide +++ b/admin/notes/tree-sitter/starter-guide | |||
| @@ -111,7 +111,7 @@ will be fontified in their capture name. | |||
| 111 | 111 | ||
| 112 | The capture name could also be a function, in which case (NODE | 112 | The capture name could also be a function, in which case (NODE |
| 113 | OVERRIDE START END) is passed to the function for fontification. START | 113 | OVERRIDE START END) is passed to the function for fontification. START |
| 114 | and END is the start and end of the region to be fontified. The | 114 | and END are the start and end of the region to be fontified. The |
| 115 | function should only fontify within that region. The function should | 115 | function should only fontify within that region. The function should |
| 116 | also allow more optional arguments with (&rest _), for future | 116 | also allow more optional arguments with (&rest _), for future |
| 117 | extensibility. For OVERRIDE check out the docstring of | 117 | extensibility. For OVERRIDE check out the docstring of |
| @@ -169,7 +169,7 @@ Neovim also has a bunch of queries to reference: | |||
| 169 | The manual explains how to read grammar files in the bottom of section | 169 | The manual explains how to read grammar files in the bottom of section |
| 170 | "Tree-sitter Language Definitions". | 170 | "Tree-sitter Language Definitions". |
| 171 | 171 | ||
| 172 | ** Debugging queires | 172 | ** Debugging queries |
| 173 | 173 | ||
| 174 | If your query has problems, use ‘treesit-query-validate’ to debug the | 174 | If your query has problems, use ‘treesit-query-validate’ to debug the |
| 175 | query. It will pop a buffer containing the query (in text format) and | 175 | query. It will pop a buffer containing the query (in text format) and |
| @@ -261,8 +261,8 @@ Indent works like this: We have a bunch of rules that look like | |||
| 261 | When the indentation process starts, point is at the BOL of a line, we | 261 | When the indentation process starts, point is at the BOL of a line, we |
| 262 | want to know which column to indent this line to. Let NODE be the node | 262 | want to know which column to indent this line to. Let NODE be the node |
| 263 | at point, we pass this node to the MATCHER of each rule, one of them | 263 | at point, we pass this node to the MATCHER of each rule, one of them |
| 264 | will match the node (eg, "this node is a closing bracket!"). Then we pass | 264 | will match the node (eg, "this node is a closing bracket!"). Then we |
| 265 | the node to the ANCHOR, which returns a point, eg, the BOL of the | 265 | pass the node to the ANCHOR, which returns a point, eg, the BOL of the |
| 266 | previous line. We find the column number of that point (eg, 4), add | 266 | previous line. We find the column number of that point (eg, 4), add |
| 267 | OFFSET to it (eg, 0), and that is the column we want to indent the | 267 | OFFSET to it (eg, 0), and that is the column we want to indent the |
| 268 | current line to (4 + 0 = 4). | 268 | current line to (4 + 0 = 4). |
| @@ -297,7 +297,7 @@ There is also a manual section for indent: "Parser-based Indentation". | |||
| 297 | 297 | ||
| 298 | When writing indent rules, you can use ‘treesit-check-indent’ to | 298 | When writing indent rules, you can use ‘treesit-check-indent’ to |
| 299 | check if your indentation is correct. To debug what went wrong, set | 299 | check if your indentation is correct. To debug what went wrong, set |
| 300 | ‘treesit--indent-verboase’ to non-nil. Then when you indent, Emacs | 300 | ‘treesit--indent-verbose’ to non-nil. Then when you indent, Emacs |
| 301 | tells you which rule is applied in the echo area. | 301 | tells you which rule is applied in the echo area. |
| 302 | 302 | ||
| 303 | #+begin_src elisp | 303 | #+begin_src elisp |
| @@ -358,7 +358,7 @@ definition node, and ’end means we want to go to the end of that node. | |||
| 358 | 358 | ||
| 359 | Tree-sitter has default implementations for | 359 | Tree-sitter has default implementations for |
| 360 | ‘beginning-of-defun-function’ and ‘end-of-defun-function’. So for | 360 | ‘beginning-of-defun-function’ and ‘end-of-defun-function’. So for |
| 361 | ordinary languages, it is suffice to set ‘treesit-defun-type-regexp’ | 361 | ordinary languages, it is enough to set ‘treesit-defun-type-regexp’ |
| 362 | to something that matches all the defun struct types in the language, | 362 | to something that matches all the defun struct types in the language, |
| 363 | and call ‘treesit-major-mode-setup’. For example, | 363 | and call ‘treesit-major-mode-setup’. For example, |
| 364 | 364 | ||
| @@ -375,8 +375,8 @@ and call ‘treesit-major-mode-setup’. For example, | |||
| 375 | If you have an imenu implementation, set ‘which-func-functions’ to | 375 | If you have an imenu implementation, set ‘which-func-functions’ to |
| 376 | nil, and which-func will automatically use imenu’s data. | 376 | nil, and which-func will automatically use imenu’s data. |
| 377 | 377 | ||
| 378 | If you want independent implementation for which-func, you can find | 378 | If you want an independent implementation for which-func, you can |
| 379 | the current function by going up the tree and looking for the | 379 | find the current function by going up the tree and looking for the |
| 380 | function_definition node. See the function below for an example. | 380 | function_definition node. See the function below for an example. |
| 381 | Since Python allows nested function definitions, that function keeps | 381 | Since Python allows nested function definitions, that function keeps |
| 382 | going until it reaches the root node, and records all the function | 382 | going until it reaches the root node, and records all the function |
| @@ -410,7 +410,7 @@ For INCLUDE-TYPE see `python-info-current-defun'." | |||
| 410 | * More features? | 410 | * More features? |
| 411 | 411 | ||
| 412 | Obviously this list is just a starting point, if there are features in | 412 | Obviously this list is just a starting point, if there are features in |
| 413 | the major mode that would benefit a parse tree, adding tree-sitter | 413 | the major mode that would benefit from a parse tree, adding tree-sitter |
| 414 | support for that would be great. But in the minimal case, just adding | 414 | support for that would be great. But in the minimal case, just adding |
| 415 | font-lock is awesome. | 415 | font-lock is awesome. |
| 416 | 416 | ||