[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2002ac376c9: ruby-ts-mode: Rehash which nodes should be treated a
From: |
Dmitry Gutov |
Subject: |
master 2002ac376c9: ruby-ts-mode: Rehash which nodes should be treated as sexps |
Date: |
Tue, 28 Mar 2023 18:09:16 -0400 (EDT) |
branch: master
commit 2002ac376c97382cace161ef0832a6faf6f376e8
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
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.
---
lisp/progmodes/ruby-ts-mode.el | 41 ++++++++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el
index 97c7cf6480c..1a085b669ee 100644
--- a/lisp/progmodes/ruby-ts-mode.el
+++ b/lisp/progmodes/ruby-ts-mode.el
@@ -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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 2002ac376c9: ruby-ts-mode: Rehash which nodes should be treated as sexps,
Dmitry Gutov <=