diff options
author | Yuan Fu <casouri@gmail.com> | 2022-12-05 18:37:47 -0800 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2022-12-05 19:56:47 -0800 |
commit | c26fe45cb8046eecaf3a74e3e7d4bc62ab511a8c (patch) | |
tree | 3cdc961f440fa79f0d9c48901c9f961d525787a8 /lisp/treesit.el | |
parent | 318bf42b410d4a8ecf0e8ff64280cfd655884877 (diff) | |
download | emacs-c26fe45cb8046eecaf3a74e3e7d4bc62ab511a8c.tar.gz emacs-c26fe45cb8046eecaf3a74e3e7d4bc62ab511a8c.tar.bz2 emacs-c26fe45cb8046eecaf3a74e3e7d4bc62ab511a8c.zip |
Fix treesit-query-capture
Before this change Ftreesit_query_capture doesn't convert character
position to byte position for BEG and END parameters. I observed
fontification issue in css files but couldn't figure out why, now I
know :-)
I decide to keep treesit--font-lock-query-expand-range, since it might
provide a escape hatch for problems we discover in the future, and it
should be very cheap so no downside of keeping it.
* lisp/textmodes/css-mode.el (css-ts-mode): Stop setting
treesit--font-lock-query-expand-range.
* lisp/treesit.el (treesit--font-lock-query-expand-range): Update
docstring.
* src/treesit.c (Ftreesit_query_capture): Convert BEG and END to byte
position. Also added parentheses wround "beg_byte - visible_beg" in
the call to ts_query_cursor_set_byte_range (i.e., style change).
Diffstat (limited to 'lisp/treesit.el')
-rw-r--r-- | lisp/treesit.el | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lisp/treesit.el b/lisp/treesit.el index eee6eee0c7f..dbbf7ec18c3 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -545,12 +545,7 @@ This should be a cons cell (START . END). When fontifying a buffer, Emacs will move the start of the query range backward by START amount, and the end of the query range by END amount. Both START and END should be positive integers or 0. This doesn't -affect the fontified range. - -Sometimes, querying on some parser with a restricted range -returns nodes not in that range but before it, which breaks -fontification. Major modes can adjust this variable as a -temporarily fix.") +affect the fontified range.") (defvar-local treesit-font-lock-feature-list nil "A list of lists of feature symbols. |