branch: externals/matlab-mode commit a488d1601f5ed520cca7cd5f1d0cec4d60f258bc Author: John Ciolfi <john.ciolfi...@gmail.com> Commit: John Ciolfi <john.ciolfi...@gmail.com>
matlab-ts-mode: indent line continuation comments in continued fcn calls --- matlab-ts-mode.el | 2 +- .../indent_class_prop_continued.m | 6 ++++++ .../indent_class_prop_continued_expected.m | 6 ++++++ .../indent_class_prop_continued_expected_msgs.m | 10 ++++++++-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el index 114d2a09f2..dcddd776cd 100644 --- a/matlab-ts-mode.el +++ b/matlab-ts-mode.el @@ -2473,7 +2473,7 @@ Example: ;; ListArrayHeight = struct( ... ;; TAB> 'Short', {1}, ... ;; See: tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued.m - ((n-p-gp ,(rx bos (or "arguments" ")") eos) + ((n-p-gp ,(rx bos (or ")" "arguments" "line_continuation") eos) ,(rx bos "function_call" eos) ,(rx bos "default_value" eos)) great-grand-parent ,matlab-ts-mode--indent-level) diff --git a/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued.m b/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued.m index d882f14ba1..65212c2991 100644 --- a/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued.m +++ b/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued.m @@ -10,5 +10,11 @@ classdef indent_class_prop_continued 'Medium', {50}, ... 'Long', {100} ... ); + + tbl = struct(... + ... name value + 'foo', 1, ... + 'bar', 1 ... + ); end end diff --git a/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued_expected.m b/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued_expected.m index d882f14ba1..65212c2991 100644 --- a/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued_expected.m +++ b/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued_expected.m @@ -10,5 +10,11 @@ classdef indent_class_prop_continued 'Medium', {50}, ... 'Long', {100} ... ); + + tbl = struct(... + ... name value + 'foo', 1, ... + 'bar', 1 ... + ); end end diff --git a/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued_expected_msgs.m b/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued_expected_msgs.m index 1a8ad892e4..475459d73d 100644 --- a/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued_expected_msgs.m +++ b/tests/test-matlab-ts-mode-indent-files/indent_class_prop_continued_expected_msgs.m @@ -6,9 +6,15 @@ classdef indent_class_prop_continued % <{Matched rule: ((lambda (node parent _bol &rest _) (and node (not (string= (treesit-node-type node) "line_continuation")) (equal (treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _) (save-excursion (goto-char bol) (line-beginning-position))) 0)}> properties % <{Matched rule: ((node-is "\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'") parent 4)}> ListArrayHeight = struct( ... % <{Matched rule: ((node-is "\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'") parent 4)}> - 'Short', {1}, ... % <{Matched rule: ((n-p-gp "\\`\\(?:)\\|arguments\\)\\'" "\\`function_call\\'" "\\`default_value\\'") great-grand-parent 4)}> + 'Short', {1}, ... % <{Matched rule: ((n-p-gp "\\`\\(?:)\\|arguments\\|line_continuation\\)\\'" "\\`function_call\\'" "\\`default_value\\'") great-grand-parent 4)}> 'Medium', {50}, ... % <{Matched rule: ((parent-is "\\`arguments\\'") parent 0)}> 'Long', {100} ... % <{Matched rule: ((parent-is "\\`arguments\\'") parent 0)}> - ); % <{Matched rule: ((n-p-gp "\\`\\(?:)\\|arguments\\)\\'" "\\`function_call\\'" "\\`default_value\\'") great-grand-parent 4)}> + ); % <{Matched rule: ((n-p-gp "\\`\\(?:)\\|arguments\\|line_continuation\\)\\'" "\\`function_call\\'" "\\`default_value\\'") great-grand-parent 4)}> + + tbl = struct(... % <{Matched rule: ((node-is "\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'") parent 4)}> + ... name value % <{Matched rule: ((n-p-gp "\\`\\(?:)\\|arguments\\|line_continuation\\)\\'" "\\`function_call\\'" "\\`default_value\\'") great-grand-parent 4)}> + 'foo', 1, ... % <{Matched rule: ((n-p-gp "\\`\\(?:)\\|arguments\\|line_continuation\\)\\'" "\\`function_call\\'" "\\`default_value\\'") great-grand-parent 4)}> + 'bar', 1 ... % <{Matched rule: ((parent-is "\\`arguments\\'") parent 0)}> + ); % <{Matched rule: ((n-p-gp "\\`\\(?:)\\|arguments\\|line_continuation\\)\\'" "\\`function_call\\'" "\\`default_value\\'") great-grand-parent 4)}> end % <{Matched rule: ((node-is "\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'") parent 0)}> end % <{Matched rule: ((node-is "\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'") parent 0)}>