branch: externals/phps-mode commit 0a32b17da840d4e05729252a2fffdb9a6d92792c Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Improved calculation for indentation for multi-line assignments --- phps-mode-functions.el | 5 ++++- phps-mode-test-functions.el | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/phps-mode-functions.el b/phps-mode-functions.el index d488712..eba2a3f 100644 --- a/phps-mode-functions.el +++ b/phps-mode-functions.el @@ -307,7 +307,10 @@ (when first-token-on-line (if (or (equal token 'T_VARIABLE) (equal token 'T_CONSTANT_ENCAPSED_STRING) - (equal token 'T_OBJECT_OPERATOR)) + (equal token 'T_ENCAPSED_AND_WHITESPACE) + (equal token 'T_OBJECT_OPERATOR) + (equal token 'T_LNUMBER) + (equal token 'T_DNUMBER)) (progn ;; (message "In assignment on new-line at %s" token) (setq in-assignment-on-new-line t)) diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el index 46d0ec5..476869a 100644 --- a/phps-mode-test-functions.el +++ b/phps-mode-test-functions.el @@ -83,9 +83,21 @@ "Switch, case, default" (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1 0)) (7 (2 0)) (8 (1 0)) (9 (2 0)) (10 (0 0))) (phps-mode-test-functions--hash-to-list (phps-mode-functions-get-lines-indent))))) - ;; TODO NOWDOC, HEREDOC + (phps-mode-test-with-buffer + "<?php\n$var =\n 500 .\n \"200\" .\n 100.0 .\n '200' .\n $this->getTail()\n ->getBottom();" + "Multi-line assignments" + ;; (message "Tokens: %s" phps-mode-lexer-tokens) + (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (1 0)) (6 (1 0)) (7 (1 0)) (8 (1 0))) (phps-mode-test-functions--hash-to-list (phps-mode-functions-get-lines-indent))))) + + + ;; TODO NOWDOC + + ;; TODO HEREDOC + + ;; TODO Multi-line single-quoted string + + ;; TODO Multi-line double-quoted strings - ;; TODO Multi-line assignments )