Closed deifactor closed 1 year ago
This is done so as to mimic how ci"
or cib
works. That said, I'm not opposed to adding a flag that can switch off the behaviour.
I'm also wondering if this should be specific to each textobj, ie things lie arguments could have this limit, but maybe not for functions. Do you have any thoughts around this?
Hmm, I didn't know that ci"
works like that. In that case this behavior makes more sense. A new parameter to evil-textobj-tree-sitter-get-textobj
could work, maybe with an option that sets the default.
The reason I ran into this was that I was running into some issues with the queries; for example, some_function(1234)
doesn't match the 'outer parameter' query since there's no trailing comma; I saw the cursor zooming off elsewhere and thought there was some weird issue computing the character positions.
IMO outer objects should fall back to inner objects if the inner exists and the outer doesn't, but I'm not sure if you agree. Separate issue anyway.
BTW, thanks for this library; when I've got a bit more free time I'd love to help. :)
A new parameter to evil-textobj-tree-sitter-get-textobj could work, maybe with an option that sets the default.
I think that makes sense.
MO outer objects should fall back to inner objects if the inner exists and the outer doesn't, but I'm not sure if you agree. Separate issue anyway.
I don't wanna force it on users, but you can provide multiple capture groups if you would like it to match both inner and outer.
(define-key evil-outer-text-objects-map "q" (evil-textobj-tree-sitter-get-textobj ("conditional.outer" "conditional.inner")))
I gave it some thought and decided to merge a global flag.
You now have: (setq evil-textobj-tree-sitter-use-next-if-not-within nil)
.
If I have a Rust file like the following
and put point inside the definition of
blah
, then the@argument.inner
motion will jump all the way to the definition ofbaz
. This is very surprising; imo if there's no text object matching the query that contains point, it should just fail.