mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
ruby-ts-mode: Rehash which nodes should be treated as sexps
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode): Recognize smaller syntactic elements as sexps too (bug#62416). Also do that for heredocs, regexps and symbol arrays. But drop binary expressions (including assignments) since they led to non-intuitive behavior.
This commit is contained in:
parent
cde38f0df3
commit
2002ac376c
1 changed files with 26 additions and 15 deletions
|
|
@ -1114,21 +1114,32 @@ leading double colon is not added."
|
|||
(setq-local treesit-defun-type-regexp ruby-ts--method-regex)
|
||||
|
||||
(setq-local treesit-sexp-type-regexp
|
||||
(regexp-opt '("class"
|
||||
"module"
|
||||
"method"
|
||||
"argument_list"
|
||||
"array"
|
||||
"hash"
|
||||
"parenthesized_statements"
|
||||
"if"
|
||||
"case"
|
||||
"when"
|
||||
"block"
|
||||
"do_block"
|
||||
"begin"
|
||||
"binary"
|
||||
"assignment")))
|
||||
(rx bol
|
||||
(or "class"
|
||||
"module"
|
||||
"method"
|
||||
"array"
|
||||
"hash"
|
||||
"parenthesized_statements"
|
||||
"if"
|
||||
"case"
|
||||
"when"
|
||||
"block"
|
||||
"do_block"
|
||||
"begin"
|
||||
"integer"
|
||||
"identifier"
|
||||
"constant"
|
||||
"simple_symbol"
|
||||
"symbol_array"
|
||||
"hash_key_symbol"
|
||||
"string"
|
||||
"string_array"
|
||||
"heredoc_body"
|
||||
"regex"
|
||||
"argument_list"
|
||||
)
|
||||
eol))
|
||||
|
||||
;; AFAIK, Ruby can not nest methods
|
||||
(setq-local treesit-defun-prefer-top-level nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue