emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ea73fd69f0: ; Fix typos in tree-sitter files


From: Juanma Barranquero
Subject: master ea73fd69f0: ; Fix typos in tree-sitter files
Date: Mon, 21 Nov 2022 22:41:42 -0500 (EST)

branch: master
commit ea73fd69f0c6251ad9b8fc8267ce0fa68495715e
Author: Juanma Barranquero <lekktu@gmail.com>
Commit: Juanma Barranquero <lekktu@gmail.com>

    ; 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.
---
 admin/notes/tree-sitter/starter-guide | 18 ++++++++---------
 lisp/treesit.el                       | 37 +++++++++++++++++------------------
 2 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/admin/notes/tree-sitter/starter-guide 
b/admin/notes/tree-sitter/starter-guide
index faf40bc64f..123dabd9f2 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.
 
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 24f0e1472d..0dcd16d89a 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -414,8 +414,8 @@ that encompasses the region between START and END."
 
 (defun treesit--merge-ranges (old-ranges new-ranges start end)
   "Merge OLD-RANGES and NEW-RANGES, discarding ranges between START and END.
-OLD-RANGES and NEW-RANGES are lists of cons of the form (BEG . END).  When
-merging the two ranges, if a range in OLD-RANGES intersects with
+OLD-RANGES and NEW-RANGES are lists of cons of the form (BEG . END).
+When merging the two ranges, if a range in OLD-RANGES intersects with
 another range in NEW-RANGES, discard the one in OLD-RANGES and
 keep the one in NEW-RANGES.  Also discard any range in OLD-RANGES
 that intersects the region marked by START and END.
@@ -521,7 +521,7 @@ Each sublist represents a decoration level.
 `font-lock-maximum-decoration' controls which levels are
 activated.
 
-Inside each sublist are feature symbols, which corresponds to the
+Inside each sublist are feature symbols, which correspond to the
 :feature value of a query defined in `treesit-font-lock-rules'.
 Removing a feature symbol from this list disables the
 corresponding query during font-lock.
@@ -531,7 +531,7 @@ definition, type, assignment, builtin, constant, keyword,
 string-interpolation, comment, doc, string, operator, property,
 preprocessor, escape-sequence, key (in key-value pairs).  Major
 modes are free to subdivide or extend on these common features.
-See the manual for more explanations on some of the feature.
+See the manual for more explanations on some of the features.
 
 For changes to this variable to take effect, run
 `treesit-font-lock-recompute-features'.")
@@ -585,7 +585,7 @@ to QUERY.  For example,
      :feature \\='script
      \"(script_element) @font-lock-builtin-face\")
 
-For each QUERY, a :language keyword and a :feature keyword is
+For each QUERY, a :language keyword and a :feature keyword are
 required.  Each query's :feature is a symbol summarizing what the
 query fontifies.  It is used to allow users to enable/disable
 certain features.  See `treesit-font-lock-kind-list' for more.
@@ -798,7 +798,7 @@ range is between START and END."
   (- (treesit-node-end node) (treesit-node-start node)))
 
 (defvar-local treesit--font-lock-fast-mode nil
-  "If this variable is t, change the way we query so its faster.
+  "If this variable is t, change the way we query so it's faster.
 This is not a general optimization and should be RARELY needed!
 See comments in `treesit-font-lock-fontify-region' for more
 detail.")
@@ -810,8 +810,7 @@ detail.")
 ;; applied by regexp-based font-lock.  The clipped part will be
 ;; fontified fine when Emacs fontifies the region containing it.
 ;;
-(defun treesit-font-lock-fontify-region
-    (start end &optional loudly)
+(defun treesit-font-lock-fontify-region (start end &optional loudly)
   "Fontify the region between START and END.
 If LOUDLY is non-nil, display some debugging information."
   (when (or loudly treesit--font-lock-verbose)
@@ -832,10 +831,10 @@ If LOUDLY is non-nil, display some debugging information."
       ;; is very fast anyway (even in large files of size ~10MB).
       ;; Plus, querying the result of `treesit-node-on' could still
       ;; miss patterns even if we use some heuristic to enlarge the
-      ;; node (how much to enlarge? to which extent?), its much safer
+      ;; node (how much to enlarge? to which extent?), it's much safer
       ;; to just use the root node.
       ;;
-      ;; Sometimes the source file has some errors that causes
+      ;; Sometimes the source file has some errors that cause
       ;; tree-sitter to parse it into a enormously tall tree (10k
       ;; levels tall).  In that case querying the root node is very
       ;; slow.  So we try to get top-level nodes and query them.  This
@@ -896,7 +895,7 @@ If LOUDLY is non-nil, display some debugging information."
   `(jit-lock-bounds ,start . ,end))
 
 (defun treesit--font-lock-notifier (ranges parser)
-  "Ensures updated parts of the parse-tree is refontified.
+  "Ensures updated parts of the parse-tree are refontified.
 RANGES is a list of (BEG . END) ranges, PARSER is the tree-sitter
 parser notifying of the change."
   (with-current-buffer (treesit-parser-buffer parser)
@@ -1083,15 +1082,15 @@ See `treesit-simple-indent-presets'.")
   "A list of presets.
 These presets that can be used as MATHER and ANCHOR in
 `treesit-simple-indent-rules'.  MACHTERs and ANCHORs are
-functions that takes 3 arguments: NODE, PARENT and BOL.
+functions that take 3 arguments: NODE, PARENT and BOL.
 
 MATCHER:
 
 \(match NODE-TYPE PARENT-TYPE NODE-FIELD NODE-INDEX-MIN NODE-INDEX-MAX)
 
     NODE-TYPE checks for NODE's type, PARENT-TYPE checks for
-    PARENT's type, NODE-FIELD checks for the filed name of NODE
-    in PARENT, NODE-INDEX-MIN and NODE-INDEX-MAX checks for
+    PARENT's type, NODE-FIELD checks for the field name of NODE
+    in PARENT, NODE-INDEX-MIN and NODE-INDEX-MAX check for
     NODE's index in PARENT.  Therefore, to match the first child
     where PARENT is \"argument_list\", use
 
@@ -1147,7 +1146,7 @@ no-indent
 
 prev-line
 
-    Returns the  first non-whitespace character on the previous line.
+    Returns the first non-whitespace character on the previous line.
 
 point-min
 
@@ -1278,7 +1277,7 @@ Return (ANCHOR . OFFSET).  This function is used by
   "How many lines of indent value do we precompute.
 In `treesit-indent-region' we indent in batches: precompute
 indent for each line, apply them in one go, let parser reparse,
-and do it again.  This way the parser don't need to unnecessarily
+and do it again.  This way the parser doesn't need to unnecessarily
 reparse after indenting every single line.")
 
 (defun treesit-indent-region (beg end)
@@ -1412,7 +1411,7 @@ indentation (target) is in green, current indentation is 
in red."
 RULES should be a value suitable for
 `treesit-simple-indent-rules'.  Return the optimized version of
 RULES."
-  ;; Right now this function just compiles queries.  it doesn't
+  ;; Right now this function just compiles queries.  It doesn't
   ;; byte-compile matchers and anchors because it doesn't make much
   ;; difference.
   (cl-loop for setting in rules
@@ -1551,8 +1550,8 @@ It can also be a list of language symbols.
 If tree-sitter is not ready, emit a warning and return nil.  If
 the user has chosen to activate tree-sitter for LANGUAGE and
 tree-sitter is ready, return non-nil.  If QUIET is t, don't emit
-warning in either case; if quiet is `message', display a message
-instead of emitting warning."
+a warning in either case; if quiet is `message', display a message
+instead of emitting a warning."
   (let ((language-list (if (consp language)
                            language
                          (list language)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]