diff options
| author | Juri Linkov | 2024-12-22 21:15:18 +0200 |
|---|---|---|
| committer | Juri Linkov | 2024-12-22 21:15:18 +0200 |
| commit | 423e1ee7d6d6f34c0bc249a8dfb14a4a25eae08a (patch) | |
| tree | dd075987aa93fd70f8c7a98608e4ba9b83be9004 | |
| parent | ec39f669f902143a68a99fb42dd05716a27736be (diff) | |
| download | emacs-423e1ee7d6d6f34c0bc249a8dfb14a4a25eae08a.tar.gz emacs-423e1ee7d6d6f34c0bc249a8dfb14a4a25eae08a.zip | |
Add treesit thing 'sexp-list' to typescript-ts-mode (bug#73404)
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode):
Add 'sexp-list' to 'treesit-thing-settings'.
(typescript-ts-mode--sexp-list-nodes): New variable.
| -rw-r--r-- | lisp/progmodes/typescript-ts-mode.el | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index edca89e5c3a..08c8a71c18e 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el | |||
| @@ -459,6 +459,35 @@ See `treesit-thing-settings' for more information.") | |||
| 459 | "Nodes that designate sexps in TypeScript. | 459 | "Nodes that designate sexps in TypeScript. |
| 460 | See `treesit-thing-settings' for more information.") | 460 | See `treesit-thing-settings' for more information.") |
| 461 | 461 | ||
| 462 | (defvar typescript-ts-mode--sexp-list-nodes | ||
| 463 | '("export_clause" | ||
| 464 | "named_imports" | ||
| 465 | "statement_block" | ||
| 466 | "_for_header" | ||
| 467 | "switch_body" | ||
| 468 | "parenthesized_expression" | ||
| 469 | "object" | ||
| 470 | "object_pattern" | ||
| 471 | "array" | ||
| 472 | "array_pattern" | ||
| 473 | "jsx_expression" | ||
| 474 | "_jsx_string" | ||
| 475 | "string" | ||
| 476 | "regex" | ||
| 477 | "arguments" | ||
| 478 | "class_body" | ||
| 479 | "formal_parameters" | ||
| 480 | "computed_property_name" | ||
| 481 | "decorator_parenthesized_expression" | ||
| 482 | "enum_body" | ||
| 483 | "parenthesized_type" | ||
| 484 | "type_arguments" | ||
| 485 | "object_type" | ||
| 486 | "type_parameters" | ||
| 487 | "tuple_type") | ||
| 488 | "Nodes that designate lists in TypeScript. | ||
| 489 | See `treesit-thing-settings' for more information.") | ||
| 490 | |||
| 462 | ;;;###autoload | 491 | ;;;###autoload |
| 463 | (define-derived-mode typescript-ts-base-mode prog-mode "TypeScript" | 492 | (define-derived-mode typescript-ts-base-mode prog-mode "TypeScript" |
| 464 | "Generic major mode for editing TypeScript. | 493 | "Generic major mode for editing TypeScript. |
| @@ -486,6 +515,7 @@ This mode is intended to be inherited by concrete major modes." | |||
| 486 | (setq-local treesit-thing-settings | 515 | (setq-local treesit-thing-settings |
| 487 | `((typescript | 516 | `((typescript |
| 488 | (sexp ,(regexp-opt typescript-ts-mode--sexp-nodes)) | 517 | (sexp ,(regexp-opt typescript-ts-mode--sexp-nodes)) |
| 518 | (sexp-list ,(regexp-opt typescript-ts-mode--sexp-list-nodes)) | ||
| 489 | (sentence ,(regexp-opt | 519 | (sentence ,(regexp-opt |
| 490 | typescript-ts-mode--sentence-nodes)) | 520 | typescript-ts-mode--sentence-nodes)) |
| 491 | (text ,(regexp-opt '("comment" | 521 | (text ,(regexp-opt '("comment" |