[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 735f1e0c89 176/212: More notes
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 735f1e0c89 176/212: More notes |
Date: |
Wed, 26 Jan 2022 01:51:23 -0500 (EST) |
branch: externals/phps-mode
commit 735f1e0c8985d5a0ff453ac743647e39f5ff4bad
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
More notes
---
phps-mode-indent.el | 63 +++++++++++++++--------------------------------------
1 file changed, 18 insertions(+), 45 deletions(-)
diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index 9d4c5f76ab..340010b010 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -166,6 +166,10 @@
"Get previous index line as reference, if any exist."
(let ((reference-line)
(old-point (point)))
+ (end-of-line)
+ (search-backward-regexp "\\(,\\|[^[({\t ]\\)" nil t)
+ (unless (string= (match-string-no-properties 0) ",")
+ (forward-char 1))
(let ((not-found-bracket-start t)
(found-colon)
(reference-line-started-bracket)
@@ -174,15 +178,17 @@
(and
not-found-bracket-start
(search-backward-regexp
- "\\([][(),]\\|=>\\)"
+ "\\([][{}(),]\\|=>\\)"
nil
t))
(let ((match (match-string-no-properties 0)))
+ (message "match: %S" match)
(cond
((or
(string= "(" match)
- (string= "[" match))
+ (string= "[" match)
+ (string= "{" match))
(setq
parenthesis-level
(1+ parenthesis-level))
@@ -202,7 +208,8 @@
((or
(string= ")" match)
- (string= "]" match))
+ (string= "]" match)
+ (string= "}" match))
(setq
parenthesis-level
(1- parenthesis-level)))
@@ -260,7 +267,6 @@
nil
t))
(let ((match (match-string-no-properties 0)))
- (message "match: %S" match)
(cond
;; Commented out line
@@ -827,47 +833,14 @@
(setq
match-type
'line-that-ends-bracket)
- (let ((old-point (point))
- (still-looking t)
- (bracket-start-line)
- (bracket-level -1))
-
- ;; Should keep track of brackets
- ;; and stop when we reach the correct bracket
- (while (and
- still-looking
- (search-backward-regexp "[][{}()]" nil t))
- (let ((match (match-string-no-properties 0)))
- (cond
- ((or
- (string= "{" match)
- (string= "(" match)
- (string= "[" match))
- (setq
- bracket-level
- (1+ bracket-level)))
- (t
- (setq
- bracket-level
- (1- bracket-level))))
-
- (when (= bracket-level 0)
- (setq
- still-looking
- nil)
- (setq
- bracket-start-line
- (buffer-substring-no-properties
- (line-beginning-position)
- (line-end-position))))))
-
- (goto-char old-point)
-
- (unless still-looking
- (setq
- new-indentation
- (phps-mode-indent--string-indentation
- bracket-start-line)))))
+ (when-let
+ ((reference-line
+ (phps-mode-indent--get-previous-reference-index-line)))
+ (message "reference-line: %S" reference-line)
+ (setq
+ new-indentation
+ (phps-mode-indent--string-indentation
+ reference-line))))
;; LINE THAT ENDS ALTERNATIVE SWITCH BLOCK
;; switch (blala):
- [elpa] externals/phps-mode 9a2573939a 094/212: More wrestling, (continued)
- [elpa] externals/phps-mode 9a2573939a 094/212: More wrestling, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7c0cb57312 098/212: Added more multi-line assignment indent tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 3a594466d5 100/212: Passed indent test for multi-line assignments, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7deebc5f79 101/212: Improved indent test descriptions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d5d80017bc 104/212: Passed indent tests for concatenated string, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e083e90ac0 108/212: Passing more indentation tests for PSR-2, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 84d447e4e6 119/212: Added TODO item, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1ab6ac7324 131/212: Added failing tests for indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7135a30446 173/212: Updated TODO items, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 63c5fef240 175/212: Started on tests for more basic functions of indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 735f1e0c89 176/212: More notes,
Christian Johansson <=
- [elpa] externals/phps-mode 73d460d5a4 181/212: Passing lexer tests with optimized lexer, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e5df43eea9 187/212: More tweaking of indentation helpers, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 413547fbf1 188/212: Searching for previous bracket now steps over optional PHP starting tags, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4b4a96fda2 208/212: Improved cache filename, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode ef97058a67 184/212: Added more tests for indentation helper functions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a1af5b11fb 040/212: More work on bookkeeping of class properties via AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4dc07c9041 050/212: Bookkeeping via AST working with assigned variables from array, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4d226f18cc 048/212: Bookkeeping via AST working with referenced foreach variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5603e6266b 047/212: SDT for array values, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 787d82313e 045/212: Bookkeeping via AST now tracks variables around inline-functions, Christian Johansson, 2022/01/26