[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 5391551287 143/212: Added a new indent test a
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 5391551287 143/212: Added a new indent test and made it pass |
Date: |
Wed, 26 Jan 2022 01:51:16 -0500 (EST) |
branch: externals/phps-mode
commit 53915512870b2bec9911374063dac196476c07a5
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added a new indent test and made it pass
---
phps-mode-indent.el | 15 +++++++++++----
test/phps-mode-test-indent.el | 4 ++++
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index 77cebafdd0..9dc1690461 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -825,7 +825,7 @@
;; If it's on the same line we ignore it
(forward-line (* -1 move-length1))
(end-of-line)
- (forward-char -1)
+ (search-backward-regexp ";" nil t) ;; Skip the semi-colon
(let ((not-found t)
(is-assignment nil)
@@ -922,7 +922,7 @@
;; If it started on the same line we ignore it
(forward-line (* -1 move-length1))
(end-of-line)
- (forward-char -1)
+ (search-backward-regexp "," nil t) ;; Skip the colon
;; (message
;; "at-line-start: %S"
@@ -1101,7 +1101,7 @@
;; If it's on the same line we ignore it
(forward-line (* -1 move-length1))
(end-of-line)
- (forward-char -1)
+ (search-backward-regexp ";" nil t) ;; Skip the semi-colon
(let ((not-found t)
(is-assignment nil)
@@ -1234,7 +1234,13 @@
;; define('_PRIVATE_ROOT',
;; 'here');
;; echo 'here';
- (when is-function-call
+ ;; but ignore
+ ;; if (true) {
+ ;; define('_PRIVATE_ROOT', 'here');
+ ;; echo 'here';
+ (when (and
+ is-function-call
+ (not is-same-line-p))
(setq
new-indentation
(- new-indentation tab-width)))
@@ -1417,6 +1423,7 @@
((and
current-line-starts-with-closing-bracket
(not previous-line-ends-with-opening-bracket))
+
;; Backtrack to line were bracket started
;; and use indentation from that line for this line
(forward-line (* -1 move-length1))
diff --git a/test/phps-mode-test-indent.el b/test/phps-mode-test-indent.el
index cbdbea942e..8f7d27516d 100644
--- a/test/phps-mode-test-indent.el
+++ b/test/phps-mode-test-indent.el
@@ -324,6 +324,10 @@
"<?php\nself::addAutoLoadPaths(array(\n _SYSTEM_ROOT_,\n
_PRIVATE_ROOT_,\n _PUBLIC_ROOT_,\n _SITE_ROOT_\n));\n"
"Multiline function call with multiline array as argument")
+ (phps-mode-test-indent--should-equal
+ "<?php\nif (true) {\n $random = self::getData();\n // My random
comment\n}\n"
+ "Comment after assignment from method call on same line")
+
)
(defun phps-mode-test-indent--get-lines-indent-psr-2 ()
- [elpa] externals/phps-mode d205d8392f 113/212: Passed another indent test, (continued)
- [elpa] externals/phps-mode d205d8392f 113/212: Passed another indent test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1a62f48783 130/212: Improved indentation in cases with multi-expressions last line does not start with closing bracket, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a3b9559880 121/212: Improved indent support for nested switch case, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode b4bf3caeb3 118/212: Added TODO note, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode b9956e278f 120/212: Indent support for closing bracket after closing multi-line assignment, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4b4a821e6e 115/212: Started refactor of indent code, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 20ad1fae08 132/212: Improved indentation arround multi-line object operators, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5f09905a1a 126/212: Fixed issue with bookkeeping and imenu not being stored, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode dc361309e0 124/212: Passing all indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a62e6be40e 133/212: Fixed indentation on line after print_r, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5391551287 143/212: Added a new indent test and made it pass,
Christian Johansson <=
- [elpa] externals/phps-mode ffda8f1b5c 128/212: Added TODO item, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2ef1168cb1 155/212: Added new failing indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 519888fe79 150/212: Added another failing indent test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7ec071188a 137/212: Added more indent unit tests for nested function calls, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 837412c0e5 140/212: Improved indentation on lines starting with a closing bracket, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode cdbcd5ebe6 154/212: Added a new failing indent test and made it pass, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode c2a7af2a98 142/212: Updated copyright years, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 91fb5402cd 158/212: Added another failing indentation and made it pass, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 66d4352052 169/212: Added more failing indent tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0ca0e447b8 167/212: Improved indentation on lines starting with a closing bracket, Christian Johansson, 2022/01/26