diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/treesit.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/treesit.c b/src/treesit.c index 54b16eb1bb3..f0c786e921d 100644 --- a/src/treesit.c +++ b/src/treesit.c | |||
| @@ -846,7 +846,6 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, | |||
| 846 | treesit_tree_edit_1 (tree, start_offset, old_end_offset, | 846 | treesit_tree_edit_1 (tree, start_offset, old_end_offset, |
| 847 | new_end_offset); | 847 | new_end_offset); |
| 848 | XTS_PARSER (lisp_parser)->need_reparse = true; | 848 | XTS_PARSER (lisp_parser)->need_reparse = true; |
| 849 | XTS_PARSER (lisp_parser)->timestamp++; | ||
| 850 | 849 | ||
| 851 | /* VISIBLE_BEG/END records tree-sitter's range of view in | 850 | /* VISIBLE_BEG/END records tree-sitter's range of view in |
| 852 | the buffer. We need to adjust them when tree-sitter's | 851 | the buffer. We need to adjust them when tree-sitter's |
| @@ -948,10 +947,7 @@ treesit_sync_visible_region (Lisp_Object parser) | |||
| 948 | this function is called), we need to reparse. */ | 947 | this function is called), we need to reparse. */ |
| 949 | if (visible_beg != BUF_BEGV_BYTE (buffer) | 948 | if (visible_beg != BUF_BEGV_BYTE (buffer) |
| 950 | || visible_end != BUF_ZV_BYTE (buffer)) | 949 | || visible_end != BUF_ZV_BYTE (buffer)) |
| 951 | { | 950 | XTS_PARSER (parser)->need_reparse = true; |
| 952 | XTS_PARSER (parser)->need_reparse = true; | ||
| 953 | XTS_PARSER (parser)->timestamp++; | ||
| 954 | } | ||
| 955 | 951 | ||
| 956 | /* Before we parse or set ranges, catch up with the narrowing | 952 | /* Before we parse or set ranges, catch up with the narrowing |
| 957 | situation. We change visible_beg and visible_end to match | 953 | situation. We change visible_beg and visible_end to match |
| @@ -1090,6 +1086,7 @@ treesit_ensure_parsed (Lisp_Object parser) | |||
| 1090 | 1086 | ||
| 1091 | XTS_PARSER (parser)->tree = new_tree; | 1087 | XTS_PARSER (parser)->tree = new_tree; |
| 1092 | XTS_PARSER (parser)->need_reparse = false; | 1088 | XTS_PARSER (parser)->need_reparse = false; |
| 1089 | XTS_PARSER (parser)->timestamp++; | ||
| 1093 | 1090 | ||
| 1094 | /* After-change functions should run at the very end, most crucially | 1091 | /* After-change functions should run at the very end, most crucially |
| 1095 | after need_reparse is set to false, this way if the function | 1092 | after need_reparse is set to false, this way if the function |
| @@ -1725,7 +1722,6 @@ buffer. */) | |||
| 1725 | ranges); | 1722 | ranges); |
| 1726 | 1723 | ||
| 1727 | XTS_PARSER (parser)->need_reparse = true; | 1724 | XTS_PARSER (parser)->need_reparse = true; |
| 1728 | XTS_PARSER (parser)->timestamp++; | ||
| 1729 | return Qnil; | 1725 | return Qnil; |
| 1730 | } | 1726 | } |
| 1731 | 1727 | ||
| @@ -2923,11 +2919,10 @@ be completely in the region. | |||
| 2923 | 2919 | ||
| 2924 | If NODE-ONLY is non-nil, return a list of nodes. | 2920 | If NODE-ONLY is non-nil, return a list of nodes. |
| 2925 | 2921 | ||
| 2926 | Besides a node, NODE can also be a parser, in which case the root node | 2922 | Besides a node, NODE can be a parser, in which case the root node of |
| 2927 | of that parser is used. | 2923 | that parser is used. NODE can also be a language symbol, in which case |
| 2928 | NODE can also be a language symbol, in which case the root node of a | 2924 | the root node of a parser for that language is used. If such a parser |
| 2929 | parser for that language is used. If such a parser doesn't exist, it | 2925 | doesn't exist, it is created. |
| 2930 | is created. | ||
| 2931 | 2926 | ||
| 2932 | Signal `treesit-query-error' if QUERY is malformed or something else | 2927 | Signal `treesit-query-error' if QUERY is malformed or something else |
| 2933 | goes wrong. You can use `treesit-query-validate' to validate and debug | 2928 | goes wrong. You can use `treesit-query-validate' to validate and debug |
| @@ -2941,8 +2936,13 @@ the query. */) | |||
| 2941 | 2936 | ||
| 2942 | treesit_initialize (); | 2937 | treesit_initialize (); |
| 2943 | 2938 | ||
| 2944 | /* Resolve NODE into an actual node. */ | 2939 | /* Resolve NODE into an actual node, signals if node not |
| 2940 | up-to-date. */ | ||
| 2945 | Lisp_Object lisp_node = treesit_resolve_node (node); | 2941 | Lisp_Object lisp_node = treesit_resolve_node (node); |
| 2942 | /* As of right now, the node returned by treesit_resolve_node always | ||
| 2943 | passes treesit_check_node; but it might not be true in the future, | ||
| 2944 | so adding the line below just to be safe. */ | ||
| 2945 | treesit_check_node (node); | ||
| 2946 | 2946 | ||
| 2947 | /* Extract C values from Lisp objects. */ | 2947 | /* Extract C values from Lisp objects. */ |
| 2948 | TSNode treesit_node = XTS_NODE (lisp_node)->node; | 2948 | TSNode treesit_node = XTS_NODE (lisp_node)->node; |
| @@ -2970,8 +2970,8 @@ the query. */) | |||
| 2970 | &signal_symbol, &signal_data)) | 2970 | &signal_symbol, &signal_data)) |
| 2971 | xsignal (signal_symbol, signal_data); | 2971 | xsignal (signal_symbol, signal_data); |
| 2972 | 2972 | ||
| 2973 | /* WARN: After this point, free TREESIT_QUERY and CURSOR before every | 2973 | /* WARN: After this point, if NEEDS_TO_FREE_QUERY_AND_CURSOR is true, |
| 2974 | signal and return if NEEDS_TO_FREE_QUERY_AND_CURSOR is true. */ | 2974 | free TREESIT_QUERY and CURSOR before every signal and return. */ |
| 2975 | 2975 | ||
| 2976 | /* Set query range. */ | 2976 | /* Set query range. */ |
| 2977 | if (!NILP (beg) && !NILP (end)) | 2977 | if (!NILP (beg) && !NILP (end)) |