emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phps-mode c5d8ec6 168/405: Indentation calculation for


From: Stefan Monnier
Subject: [elpa] externals/phps-mode c5d8ec6 168/405: Indentation calculation for class implement working
Date: Sat, 13 Jul 2019 10:00:06 -0400 (EDT)

branch: externals/phps-mode
commit c5d8ec66580e82c5cb7b331395f2c5f3d0f211b8
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Indentation calculation for class implement working
---
 phps-mode-functions.el      |  5 ++++-
 phps-mode-test-functions.el | 11 ++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 2e19838..b314a4a 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -336,7 +336,10 @@
               (if in-class-declaration
                   (if (string= token "{")
                       (progn
-                        (setq in-class-declaration nil))
+                        (setq in-class-declaration nil)
+                        (when first-token-on-line
+                          (setq first-token-is-nesting-increase nil)
+                          (setq first-token-is-nesting-decrease t)))
                     (when first-token-on-line
                       (setq in-class-declaration-level 1)))
                 (when (equal token 'T_CLASS)
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 536f31b..aa035ed 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -104,21 +104,26 @@
   (phps-mode-test-with-buffer
    "<?php\nclass MyClass extends MyAbstract implements\n    myInterface,\n    
myInterface2\n{\n}\n"
    "Class multi-line implements"
-   (message "Tokens: %s" phps-mode-lexer-tokens)
+   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
   (phps-mode-test-with-buffer
    "<?php\n$var = \"A line\nmore text here\nlast line here\";"
    "Multi-line double-quoted string"
-   (message "Tokens: %s" phps-mode-lexer-tokens)
+   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0))) 
(phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
   (phps-mode-test-with-buffer
    "<?php\n$var = 'A line\nmore text here\nlast line here';"
    "Multi-line single-quoted string"
-   (message "Tokens: %s" phps-mode-lexer-tokens)
+   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0))) 
(phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
+  ;; TODO Test concatenated string outside assignments
+  ;; TODO Test HEREDOC outside assignment
+  ;; TODO Test multi-line single-quoted string outside assignment
+  ;; TODO Test multi-line double-quoted string outside assignment
+
   )
 
 ;; TODO Add unit tests for HEREDOC and NOWDOC regions as well



reply via email to

[Prev in Thread] Current Thread [Next in Thread]