" nodes should not be sexps? - #78
Merged
Merged
Conversation
Owner
|
Yeah, looks like a bug to me. Can you add some regression tests covering this? |
bbatsov
reviewed
Sep 5, 2026
| (sexp (not ,(rx (or "{" "}" "(" ")" "[" "]" "[|" "|]" | ||
| "," "." ";" ";;" ":" "::" ":>" "->" | ||
| "<-" "=" "|" "..")))) | ||
| "<-" "=" "|" ".." "\"")))) |
Owner
There was a problem hiding this comment.
Confirmed on Emacs 31.1 with the stock grammar: before this change (treesit-thing-at (point) 'sexp) at the opening quote returns the bare " node, with it you get the whole string node. C-M-f/C-M-b behave the same either way, so it's mostly thing-at-point-style consumers that notice.
Two more cases worth covering while you're at it:
- Char literals have the same bug: point before
'a'yields the bare'node, so"'"should join the exclusion list. That's safe for type variables, since'ain a type parses as a singletype_variabletoken with no anonymous'child. {|...|}quoted strings are already fine (the{is excluded and thing-at returns the wholequoted_string), but a regression test for them alongside strings and char literals would pin all three down.
Contributor
Author
There was a problem hiding this comment.
Done, lmk if you'd like it done differently
treesit-thing-at only exists from Emacs 30, so the new specs are pending on 29.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now
(treesit-thing-at (point) 'sexp)with point before the opening quote of a string returns the node corresponding to the quote only, which I assume is a bug?