>>>>>>>> +# C-M-f on '[' doesn't jump to after ']' >>>>>>>> +hash['key'] >>>>>>>> + >>>>>> >>>>>> As discussed previously, there is no specific node which spans from [ to >>>>>> ]. Some custom code could probably be written (there *are* leaf nodes for [ >>>>>> and ]), but the current capabilities of treesit-thing-settings don't offer >>>>>> a good way to plug that in. >>>>> Like for point inside strings, this might require more general changes >>>>> that take into account syntax tables. >>>> >>>> Possibly, but I expect a solution that doesn't use the syntax table would >>>> be tried first. >>> Since there is no available information from treesit, handling >>> treesit-forward-sexp inside strings/comments could forward to the syntax table >>> like `prog-fill-reindent-defun' forwards to `fill-paragraph'. > > Shouldn't treesit-forward-sexp provide a way for ts-modes to override > the default handling? By default for all ts-modes such a hook could > check if point is inside strings/comments then to use syntax navigation. This is now implemented in bug#68993. So here is the patch that handles such cases as C-M-f jumping from '[' to ']' in hash[:key] hash['key'] and from '{' to '}' in "abc #{ghi} def"