branch: externals/matlab-mode
commit 5c4063e93bf88974d7887f3a9510a24e3eb86b5f
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: fix indent of continued namespace functions
---
matlab-ts-mode.el | 10 ++++++++++
.../indent_namespace_fcn_continued.m | 21 +++++++++++++++++++++
.../indent_namespace_fcn_continued_expected.m | 21 +++++++++++++++++++++
3 files changed, 52 insertions(+)
diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el
index 10d266f8a1..b10a79f5d6 100644
--- a/matlab-ts-mode.el
+++ b/matlab-ts-mode.el
@@ -2326,6 +2326,12 @@ Example:
;; <TAB> 2, ...
((parent-is ,(rx bos "arguments" eos)) parent 0)
+ ;; I-Rule: someNamespace1.subNamespace2.myFunction( ...
+ ;; TAB> a, ... % comment for param1
+ ;; See:
tests/test-matlab-ts-mode-indent-files/indent_namespace_fcn_continued.m
+ ((n-p-gp ,(rx bos "arguments" eos) ,(rx bos "function_call" eos) ,(rx bos
"field_expression" eos))
+ grand-parent ,matlab-ts-mode--indent-level)
+
;; I-Rule: my_function( ...
;; <TAB> 1, ...
((node-is ,(rx bos "arguments" eos)) parent ,matlab-ts-mode--indent-level)
@@ -3533,6 +3539,10 @@ so configuration variables of that mode, do not affect
this mode.
;; Activate MATLAB script ";; heading" matlab-sections-minor-mode if needed
(matlab-sections-auto-enable-on-mfile-type-fcn
(matlab-ts-mode--mfile-type))
+ ;; TODO view errors
+ ;; Add matlab-ts-mode-view-syntax-errors in a compilation mode buffer
(g to refresh),
+ ;; add to menu
+ ;;
;; TODO [future] Indent - complex for statement
;; function a = foo(inputArgument1)
;; for (idx = (a.b.getStartValue(((inputArgument1 +
someOtherFunction(b)) * 2 - ...
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_namespace_fcn_continued.m
b/tests/test-matlab-ts-mode-indent-files/indent_namespace_fcn_continued.m
new file mode 100644
index 0000000000..9c853c4113
--- /dev/null
+++ b/tests/test-matlab-ts-mode-indent-files/indent_namespace_fcn_continued.m
@@ -0,0 +1,21 @@
+% -*- matlab-ts -*-
+
+function d=indent_namespace_fcn_continued(a, b)
+
+ try
+ d = [a;b];
+ catch
+ disp('[a;b] failed');
+ end
+
+ % Function arguments are aligned when the first argument follows the open
parenthesis
+ someNamespace1.subNamespace2.myFunction(a, ... % comment for param1
+ b); % comment for param2
+
+
+ % Function arguments are indented and aligned when the first argument is
on the next line:
+ someNamespace1.subNamespace2.myFunction( ...
+ a, ... % comment for param1
+ b); % comment for param2
+
+end % this function has an end
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_namespace_fcn_continued_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_namespace_fcn_continued_expected.m
new file mode 100644
index 0000000000..3b2b8e79ea
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_namespace_fcn_continued_expected.m
@@ -0,0 +1,21 @@
+% -*- matlab-ts -*-
+
+function d=indent_namespace_fcn_continued(a, b)
+
+ try
+ d = [a;b];
+ catch
+ disp('[a;b] failed');
+ end
+
+ % Function arguments are aligned when the first argument follows the open
parenthesis
+ someNamespace1.subNamespace2.myFunction(a, ... % comment for param1
+ b); % comment for param2
+
+
+ % Function arguments are indented and aligned when the first argument is
on the next line:
+ someNamespace1.subNamespace2.myFunction( ...
+ a, ... % comment for param1
+ b); % comment for param2
+
+end % this function has an end