branch: externals/phps-mode
commit b1d28202e568ee61bd4d950bb99ee5073314b4f0
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Fixed issue with indentation of square bracket arrays in assignments
---
phps-mode-functions.el | 5 +++--
phps-mode-test-functions.el | 5 +++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 41e7903..3f0fb68 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -464,7 +464,8 @@
(and (string= token ")")
(< round-bracket-level (car
in-assignment-round-bracket-level)))
(and (string= token ",")
- (= round-bracket-level (car
in-assignment-round-bracket-level)))
+ (= round-bracket-level (car
in-assignment-round-bracket-level))
+ (= square-bracket-level (car
in-assignment-square-bracket-level)))
(and (string= token"]")
(< square-bracket-level (car
in-assignment-square-bracket-level)))
(and (equal token 'T_FUNCTION)
@@ -473,7 +474,7 @@
;; NOTE Ending an assignment because of function token
is to support PSR-2 Closures
(when phps-mode-functions-verbose
- (message "Ended assignment"))
+ (message "Ended assignment at %s" token))
(pop in-assignment-square-bracket-level)
(pop in-assignment-round-bracket-level)
(unless in-assignment-round-bracket-level
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 8ec1b0b..0cca066 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -182,6 +182,11 @@
"Concatenated echo string with function call"
(should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (1
0)) (7 (0 0))) (phps-mode-test-hash-to-list
(phps-mode-functions-get-lines-indent)))))
+ (phps-mode-test-with-buffer
+ "<?php\n$options = [\n 0 => [\n 'label' => __('No'),\n
'value' => 0,\n ],\n];"
+ "Assignment with square bracketed array"
+ (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1
0)) (7 (0 0))) (phps-mode-test-hash-to-list
(phps-mode-functions-get-lines-indent)))))
+
)
(defun phps-mode-test-functions-get-lines-indent-psr-2 ()