branch: externals/matlab-mode
commit 3058d99071e3177df5e47c976fc72c204349de0d
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: fix indent of enumeration's when code is incomplete
---
matlab-ts-mode.el | 9 +++++++++
.../indent_comments_in_blocks.skip.typing.txt | 1 -
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el
index 1f1ee93813..161f5cf43c 100644
--- a/matlab-ts-mode.el
+++ b/matlab-ts-mode.el
@@ -1323,6 +1323,7 @@ Prev-siblings:
"classdef"
"properties"
"property"
+ "enumeration"
"events"
"methods"
"if"
@@ -1409,6 +1410,12 @@ Prev-siblings:
(let ((anchor-node (or ancestor-to-check
prev-sibling-to-check)))
(when anchor-node
+ (let ((anchor-last-child (treesit-node-child anchor-node -1)))
+ (when (and (equal (treesit-node-type anchor-last-child) "end")
+ (or (not node)
+ (< (treesit-node-start anchor-last-child)
(treesit-node-start node))))
+ (setq anchor-node anchor-last-child)))
+
(let ((indent-level (if (and node (string= (treesit-node-type
node) "end"))
(progn
(when (string= "property"
(treesit-node-type anchor-node))
@@ -1460,6 +1467,8 @@ Prev-siblings:
matlab-ts-mode--indent-level))
((rx (seq bos (or "switch" "case"
"otherwise") eos))
matlab-ts-mode--switch-indent-level)
+ ("end"
+ 0)
(_
(if last-child-of-error-node
;; Part of a continuation, so 4 for
that plus 4 for parent
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_comments_in_blocks.skip.typing.txt
b/tests/test-matlab-ts-mode-indent-files/indent_comments_in_blocks.skip.typing.txt
deleted file mode 100644
index 9596a8a33f..0000000000
---
a/tests/test-matlab-ts-mode-indent-files/indent_comments_in_blocks.skip.typing.txt
+++ /dev/null
@@ -1 +0,0 @@
-Some items not indented correclty.