[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 40ce934c11 116/212: Indent support for string
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 40ce934c11 116/212: Indent support for string-doc in assignment |
Date: |
Wed, 26 Jan 2022 01:51:08 -0500 (EST) |
branch: externals/phps-mode
commit 40ce934c11f3e9fc45686f1ad0e937abce62c0dc
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Indent support for string-doc in assignment
---
phps-mode-indent.el | 62 ++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 54 insertions(+), 8 deletions(-)
diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index 9d48448496..2a39eb9df4 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -222,7 +222,7 @@
(previous-line-starts-with-opening-doc-comment
(phps-mode-indent--string-starts-with-opening-doc-comment
previous-line-string))
- (previous-line-starts-with-closing-doc-comment
+ (previous-line-ends-with-closing-doc-comment
(phps-mode-indent--string-ends-with-closing-doc-comment
previous-line-string))
(previous-line-ends-with-assignment
@@ -735,6 +735,11 @@
;; 'here'
;; );
;; echo 'here';
+ ;; or
+ ;; $var = <<<EOD
+ ;; OKASDOKASD
+ ;; EOD;
+ ;; echo 'here';
((and
previous-line-ends-with-terminus
(string= previous-line-ends-with-terminus ";")
@@ -752,18 +757,30 @@
(let ((not-found t)
(is-assignment nil)
+ (is-string-doc)
(parenthesis-level 0)
(is-bracket-less-command nil)
(is-same-line-p t))
- (while (and
- not-found
- (search-backward-regexp
"\\(;\\|{\\|(\\|)\\|=\\|echo[\t ]+\\|print[\t ]+\\|\n\\)" nil t))
- (let ((match
- (buffer-substring-no-properties
- (match-beginning 0) (match-end 0))))
+ (while
+ (and
+ not-found
+ (search-backward-regexp
+ "\\(;\\|{\\|(\\|)\\|=\\|echo[\t ]+\\|print[\t
]+\\|\n\\|<<<'?\"?[a-zA-Z0-9]+'?\"?\\)"
+ nil
+ t))
+ (let ((match (match-string-no-properties 0)))
(cond
((string= match "\n")
(setq is-same-line-p nil))
+ ((string-match-p
+ "<<<'?\"?[a-zA-Z0-9]+'?\"?"
+ match)
+ (setq
+ is-string-doc
+ t)
+ (setq
+ not-found
+ nil))
(t
(when (string= match ")")
(setq parenthesis-level (1- parenthesis-level)))
@@ -780,6 +797,18 @@
parenthesis-level
(1+ parenthesis-level)))))))
+ ;; $var = <<<EOD
+ ;; OKASDOKASD
+ ;; EOD;
+ ;; echo 'here';
+ (when is-string-doc
+ (setq
+ new-indentation
+ (phps-mode-indent--string-indentation
+ (buffer-substring-no-properties
+ (line-beginning-position)
+ (line-end-position)))))
+
;; echo 'there' .
;; 'here';
;; echo 'here';
@@ -868,6 +897,12 @@
;; array(
;; 'hello'
;; )
+ ;; but ignore
+ ;; [
+ ;; ]
+ ;; or
+ ;; array(
+ ;; )
((and
current-line-starts-with-closing-bracket
(not previous-line-ends-with-opening-bracket))
@@ -875,13 +910,19 @@
new-indentation
(- new-indentation tab-width)))
+ ;; /**
+ ;; * here
+ ;; but ignore
+ ;; /** */
+ ;; here
((and
previous-line-starts-with-opening-doc-comment
- (not previous-line-starts-with-closing-doc-comment))
+ (not previous-line-ends-with-closing-doc-comment))
(setq
new-indentation
(+ new-indentation 1)))
+ ;; $var =
((and
previous-line-ends-with-assignment
(<= previous-bracket-level 0))
@@ -889,6 +930,11 @@
new-indentation
(+ new-indentation tab-width)))
+ ;; )) {
+ ;; echo 'here';
+ ;; or
+ ;; ]][
+ ;; 25
((and
previous-line-ends-with-opening-bracket
(< previous-bracket-level 0))
- [elpa] externals/phps-mode 1cc4aed616 016/212: Passing first bookkeeping test via generation via parser SDT, (continued)
- [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
- [elpa] externals/phps-mode d9cbe630b3 068/212: Passing bookkeeping of variables inside echo statements, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0919855a31 073/212: Added SDT for concat operation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5df554fc47 070/212: Bookkeeping via AST properly handles $this reference in only non-static methods, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2432928a86 096/212: Indentation passing more tests for alternative control structures, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode cef879268b 103/212: Added two new tests for failing indentation for multi-line concatenated strings, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 40ce934c11 116/212: Indent support for string-doc in assignment,
Christian Johansson <=
- [elpa] externals/phps-mode fbe600500f 135/212: More work on array and argument element indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 6cb18913e4 152/212: Improved indentation for lines ending with closing bracket and comma, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 26d7b64086 144/212: Added TODO item for indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0e7eb04800 149/212: Passing indentation test for multiple function arguments with default values, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2e16122284 153/212: Improved indentation on line after closing bracket and comma, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1825ee499b 151/212: More wrestling with indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 29fee20e43 141/212: Passed all tests for indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 6a49784b8b 161/212: When indentation search previous code lines it skips commented out lines, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5432a61340 162/212: Improved indentation around closing of multi-dimensional brackets, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 28a5302e08 148/212: Passing indentation on line after closing bracket and command and were current line starts with closing bracket, Christian Johansson, 2022/01/26