mirrored from git://git.sv.gnu.org/emacs.git
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Offset ranges before applying embedded tree-sitter parser
This feature would allow treesitter major modes to easily specify offsets when using embeded parsers. A potential use case for this is javascript template strings, when we want to apply a different parser to the string's contents, but do not want to include the template string's delimiters. * lisp/treesit.el (treesit-query-range): Accept an optional offest arg, apply the offset to all returned ranges. (treesit-range-rules): Accept an optional :offset keyword arg to adjust ranges an embded parser is applied to. (treesit-update-ranges): Forward optional :offset setting from `treesit-range-rules' to `treesit-query-rang'. * test/lisp/treesit-tests.el (treesit-range-offset): Tests the new offset functionality.
- Loading branch information
1 parent
9ab8b96
commit b892da5
Showing
2 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters