diff options
author | Juanma Barranquero <lekktu@gmail.com> | 2022-11-22 04:40:49 +0100 |
---|---|---|
committer | Juanma Barranquero <lekktu@gmail.com> | 2022-11-22 04:40:49 +0100 |
commit | ea73fd69f0c6251ad9b8fc8267ce0fa68495715e (patch) | |
tree | e0631740c8aef46d68080214f6bbf2900fa8a996 /admin/notes | |
parent | 19954da8dd927f9db4ca95d8a1320207e6c404cd (diff) | |
download | emacs-ea73fd69f0c6251ad9b8fc8267ce0fa68495715e.tar.gz emacs-ea73fd69f0c6251ad9b8fc8267ce0fa68495715e.tar.bz2 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/notes')
-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. The capture name could also be a function, in which case (NODE OVERRIDE START END) is passed to the function for fontification. START -and END is the start and end of the region to be fontified. The +and END are the start and end of the region to be fontified. The function should only fontify within that region. The function should also allow more optional arguments with (&rest _), for future extensibility. For OVERRIDE check out the docstring of @@ -169,7 +169,7 @@ Neovim also has a bunch of queries to reference: The manual explains how to read grammar files in the bottom of section "Tree-sitter Language Definitions". -** Debugging queires +** Debugging queries If your query has problems, use ‘treesit-query-validate’ to debug the 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 When the indentation process starts, point is at the BOL of a line, we want to know which column to indent this line to. Let NODE be the node at point, we pass this node to the MATCHER of each rule, one of them -will match the node (eg, "this node is a closing bracket!"). Then we pass -the node to the ANCHOR, which returns a point, eg, the BOL of the +will match the node (eg, "this node is a closing bracket!"). Then we +pass the node to the ANCHOR, which returns a point, eg, the BOL of the previous line. We find the column number of that point (eg, 4), add OFFSET to it (eg, 0), and that is the column we want to indent the current line to (4 + 0 = 4). @@ -297,7 +297,7 @@ There is also a manual section for indent: "Parser-based Indentation". When writing indent rules, you can use ‘treesit-check-indent’ to check if your indentation is correct. To debug what went wrong, set -‘treesit--indent-verboase’ to non-nil. Then when you indent, Emacs +‘treesit--indent-verbose’ to non-nil. Then when you indent, Emacs tells you which rule is applied in the echo area. #+begin_src elisp @@ -358,7 +358,7 @@ definition node, and ’end means we want to go to the end of that node. Tree-sitter has default implementations for ‘beginning-of-defun-function’ and ‘end-of-defun-function’. So for -ordinary languages, it is suffice to set ‘treesit-defun-type-regexp’ +ordinary languages, it is enough to set ‘treesit-defun-type-regexp’ to something that matches all the defun struct types in the language, and call ‘treesit-major-mode-setup’. For example, @@ -375,8 +375,8 @@ and call ‘treesit-major-mode-setup’. For example, If you have an imenu implementation, set ‘which-func-functions’ to nil, and which-func will automatically use imenu’s data. -If you want independent implementation for which-func, you can find -the current function by going up the tree and looking for the +If you want an independent implementation for which-func, you can +find the current function by going up the tree and looking for the function_definition node. See the function below for an example. Since Python allows nested function definitions, that function keeps going until it reaches the root node, and records all the function @@ -410,7 +410,7 @@ For INCLUDE-TYPE see `python-info-current-defun'." * More features? Obviously this list is just a starting point, if there are features in -the major mode that would benefit a parse tree, adding tree-sitter +the major mode that would benefit from a parse tree, adding tree-sitter support for that would be great. But in the minimal case, just adding font-lock is awesome. |