[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode ff62626f48 110/212: Passing indent test for s
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode ff62626f48 110/212: Passing indent test for square bracket array |
Date: |
Wed, 26 Jan 2022 01:51:08 -0500 (EST) |
branch: externals/phps-mode
commit ff62626f481cc378bafbc3a01e1735bd71a5efc1
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Passing indent test for square bracket array
---
phps-mode-indent.el | 25 +++++++++++++------------
test/phps-mode-test-indent.el | 2 +-
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index 6504cff378..16e1ca4d74 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -68,7 +68,7 @@
"If STRING start with closing bracket, return it, otherwise return nil."
(phps-mode-indent--string-starts-with-regexp
string
- "[\t ]*\\([\]})[]\\)"
+ "[\t ]*\\([\]})]\\)"
1))
(defun phps-mode-indent--string-starts-with-opening-bracket (string)
@@ -258,8 +258,6 @@
(phps-mode-indent--backwards-looking-at
"\r+\\([\t ]*\\)class[\r\t ]+[a-zA-Z0-9_]+[\r\t
]+\\(extends[\r\t ]+[a-zA-Z0-9_]+\\)?[\r\t ]*\\(implements[\r\t
]+[a-zA-Z0-9_]+\\)?$")))
(let ((old-indentation (length (match-string 1
backwards-string))))
- ;; TODO Need to find away to prevent this matching <?php
class
- (message "backwards-string: %S = %S" backwards-string
old-indentation)
(setq new-indentation (+ old-indentation tab-width)))))
;; class MyClass implements
@@ -326,7 +324,7 @@
(setq
new-indentation
(+ new-indentation tab-width)))
-
+
(when (and
previous-line-ends-with-terminus
(string=
@@ -590,14 +588,6 @@
new-indentation
(- new-indentation tab-width)))
- ;; (message "\ncurrent-line-string: %S" current-line-string)
- ;; ;; (message "current-line-starts-with-closing-bracket: %S"
current-line-starts-with-closing-bracket)
- ;; (message "previous-line-string: %S" previous-line-string)
- ;; ;; (message "previous-line-starts-with-opening-doc-comment:
%S" previous-line-starts-with-opening-doc-comment)
- ;; (message "previous-bracket-level: %S" previous-bracket-level)
- ;; (message "previous-indentation: %S" previous-indentation)
- ;; (message "new-indentation: %S" new-indentation)
-
;; switch ($condition) {
;; case true:
;; echo 'here';
@@ -653,6 +643,7 @@
(setq new-indentation (+ new-indentation tab-width)))
+
(when (> previous-bracket-level 0)
(if (< previous-bracket-level tab-width)
(setq new-indentation (+ new-indentation 1))
@@ -681,6 +672,7 @@
(< previous-bracket-level 0))
(setq new-indentation (+ new-indentation tab-width)))
+
;; $var .=
;; 'hello';
;; echo 'here';
@@ -690,6 +682,7 @@
;; echo 'here';
(when (and
previous-line-ends-with-terminus
+ (string= previous-line-ends-with-terminus ";")
(not (string-match-p "^[\t ]*\\(echo[\t ]+\\|print[\t
]+\\)" previous-line-string)))
;; Back-trace buffer from previous line
@@ -739,6 +732,14 @@
(setq new-indentation 0))
;; (message "new-indentation: %S previous-bracket-level: %S
old-indentation: %S" new-indentation previous-bracket-level old-indentation)
+ ;; (message "\ncurrent-line-string: %S" current-line-string)
+ ;; ;; (message "current-line-starts-with-closing-bracket: %S"
current-line-starts-with-closing-bracket)
+ ;; (message "previous-line-string: %S" previous-line-string)
+ ;; ;; (message "previous-line-starts-with-opening-doc-comment:
%S" previous-line-starts-with-opening-doc-comment)
+ ;; (message "previous-bracket-level: %S" previous-bracket-level)
+ ;; (message "previous-indentation: %S" previous-indentation)
+ ;; (message "new-indentation: %S" new-indentation)
+
(indent-line-to new-indentation)))))
;; Only move to end of line if point is the current point and is at end
of line
(when (equal point (point))
diff --git a/test/phps-mode-test-indent.el b/test/phps-mode-test-indent.el
index c2bcdc3672..bd8d4c6b72 100644
--- a/test/phps-mode-test-indent.el
+++ b/test/phps-mode-test-indent.el
@@ -70,7 +70,7 @@
"DOC-COMMENT")
(phps-mode-test-indent--should-equal
- "<?php\nmyFunction(array(\n 23,\n [\n 25\n ]\n )\n);"
+ "<?php\nmyFunction(array(\n 23,\n [\n 25\n ]\n));"
"Round and square bracket expressions")
(phps-mode-test-indent--should-equal
- [elpa] externals/phps-mode 8652f7162e 014/212: Started on bookkeeping generation via parser SDT, (continued)
- [elpa] externals/phps-mode 8652f7162e 014/212: Started on bookkeeping generation via parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a0d2abc2ee 009/212: More working on imenu generation via parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode c7e308a13f 024/212: Added SDT foreach($x as $key => $value), Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d44e79ad03 028/212: More work on grammar SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f79b6118a4 087/212: Optimization of string indentation function, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode b94ee63396 089/212: More work on indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d8503c70bb 106/212: Passing indent tests for switch case, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4f20de353e 109/212: Passed indent tests for PSR-2, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 6655248e86 105/212: Passing indent test for regular switch statement, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4e5be4f8f8 112/212: More indentation work for mixed PHP/HTML content, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode ff62626f48 110/212: Passing indent test for square bracket array,
Christian Johansson <=
- [elpa] externals/phps-mode 50d006852c 129/212: Fixed issue with indent being dependent on position of point on current line, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 3de8eff9f1 114/212: More wrestling with indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d3b5a85b70 001/212: Using property list as basis for AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a80c12ef14 005/212: Passing imenu-generation for file with multiple namespaces, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0071b40aae 007/212: Syntax coloring is now in separate file, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1cc4aed616 016/212: Passing first bookkeeping test via generation via parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode b3b27951bd 015/212: More work on bookkeeping, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 395a4ed045 036/212: Started on bookkeeping via parser SDT for properties, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 69341c9709 039/212: More working on bookkeeping of class properties via parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode cefab36fa8 054/212: More work on bookkeeping arrow function variables, Christian Johansson, 2022/01/26