branch: externals/matlab-mode
commit d4fdf2fae1a88d69f6890a3187b7efa9494ca2b9
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>

    matlab-ts-mode: more indent fixes when matlab code is incomplete
---
 matlab-ts-mode.el                                  | 26 ++++++++++++++++++++++
 .../indent_comment_after_prop.skip.typing.txt      |  1 -
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el
index 401fc1f7e9..1f1ee93813 100644
--- a/matlab-ts-mode.el
+++ b/matlab-ts-mode.el
@@ -1325,6 +1325,15 @@ Prev-siblings:
                                          "property"
                                          "events"
                                          "methods"
+                                         "if"
+                                         "switch"
+                                         "case"
+                                         "otherwise"
+                                         "for"
+                                         "parfor"
+                                         "while"
+                                         "try"
+                                         "catch"
                                          "("
                                          "["
                                          "{"
@@ -1434,6 +1443,23 @@ Prev-siblings:
                                        matlab-ts-mode--function-indent-level))
                                     ("row"
                                      0)
+                                    ("try"
+                                     (if (and node
+                                              (string-match-p (rx bos 
"catch_clause" eos)
+                                                              
(treesit-node-type node)))
+                                         0
+                                       matlab-ts-mode--indent-level))
+
+                                    ("if"
+                                     (if (and node
+                                              (string-match-p (rx bos (or 
"elseif_clause"
+                                                                          
"else_clause")
+                                                                  eos)
+                                                              
(treesit-node-type node)))
+                                         0
+                                       matlab-ts-mode--indent-level))
+                                    ((rx (seq bos (or "switch" "case" 
"otherwise") eos))
+                                     matlab-ts-mode--switch-indent-level)
                                     (_
                                      (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_comment_after_prop.skip.typing.txt
 
b/tests/test-matlab-ts-mode-indent-files/indent_comment_after_prop.skip.typing.txt
deleted file mode 100644
index 1433285fbe..0000000000
--- 
a/tests/test-matlab-ts-mode-indent-files/indent_comment_after_prop.skip.typing.txt
+++ /dev/null
@@ -1 +0,0 @@
-Some comments are not indented correctly

Reply via email to