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

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

[elpa] externals/phps-mode 463ceedbbb 6/8: Passing new indent test for l


From: Christian Johansson
Subject: [elpa] externals/phps-mode 463ceedbbb 6/8: Passing new indent test for line after commented out assignment
Date: Thu, 27 Jan 2022 15:57:25 -0500 (EST)

branch: externals/phps-mode
commit 463ceedbbb0155a71b500f747920d6b8a94e01a3
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Passing new indent test for line after commented out assignment
---
 phps-mode-indent.el           | 13 +++++++++++++
 test/phps-mode-test-indent.el | 12 +++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index a00d7b65d9..0977a1a38f 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -531,6 +531,19 @@
                 (unless (or
                          line-is-empty-p
                          line-is-comment-p)
+
+                  ;; Does line contain comment?
+                  (when (string-match-p
+                         "\\(//[^'\"]+$\\|#[^'\"]+$\\|/\\*.+\\*/\\)"
+                         line-string)
+                    ;; Delete comment region
+                    (setq
+                     line-string
+                     (replace-regexp-in-string
+                      "\\(//[^'\"]+$\\|#[^'\"]+$\\|/\\*.+\\*/\\)"
+                      ""
+                      line-string)))
+
                   (cond
                    ((= searching-previous-lines 2)
                     (setq
diff --git a/test/phps-mode-test-indent.el b/test/phps-mode-test-indent.el
index ef7d6110d6..4152c9d414 100644
--- a/test/phps-mode-test-indent.el
+++ b/test/phps-mode-test-indent.el
@@ -660,21 +660,19 @@
    "<?php\nif (true) {\n    $html .= 'My text'\n        . 'and more text';\n   
 foreach ($data as $key => $fields) {\n        $html .= '<strong>' . $key . 
'</strong>';\n        foreach ($fields as $key => $value) {\n            $html 
.= '<span>' . $value . '</span>';\n        }\n        $html .= '</ul></li>';\n  
  }\n    $html .= '</dd>';\n}\n"
    "Two nested foreach loops containing string concatenation assignments")
 
-  ;; TODO Make this pass
-  (phps-mode-test-indent--should-equal
-   "<?php\n$var = Object->myMethod()\n    ->myMethod2();\necho 'here';"
-   "Line after assignment were an chaining of object methods started")
-
-  ;; TODO Make this pass
   (phps-mode-test-indent--should-equal
    "<?php\n$var = 23; /* 23 = Company */\necho 'was here';"
    "Line after line that have an assignment doc-commented out")
 
-  ;; TODO Make this pass
   (phps-mode-test-indent--should-equal
    "<?php\n$var = 23; // 23 = Company\necho 'was here';"
    "Line after line that have an assignment commented out")
 
+  ;; TODO Make this pass
+  (phps-mode-test-indent--should-equal
+   "<?php\n$var = Object->myMethod()\n    ->myMethod2();\necho 'here';"
+   "Line after assignment were an chaining of object methods started")
+
   )
 
 (defun phps-mode-test-indent--get-lines-indent-psr-2 ()



reply via email to

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