[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 0b3ced4 145/405: First test for new indentati
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 0b3ced4 145/405: First test for new indentation function passes |
Date: |
Sat, 13 Jul 2019 10:00:01 -0400 (EDT) |
branch: externals/phps-mode
commit 0b3ced435710c7685477db67a605c3aa66246ad9
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
First test for new indentation function passes
---
phps-mode-functions.el | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 09b55c3..f782565 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -40,7 +40,7 @@
;; TODO Support indentation for multi-line assignments
(defun phps-mode-functions-get-lines-indent ()
- "Get the column and tuning indentation-numbers for each line in buffer that
contains tokens."
+ "Get the column and tuning indentation-numbers for each line in buffer that
contain tokens."
(if (boundp 'phps-mode-lexer-tokens)
(save-excursion
(beginning-of-line)
@@ -64,7 +64,9 @@
(last-line-number 0)
(first-token-on-line nil)
(line-indents (make-hash-table :test 'equal))
- (change-of-scope nil))
+ (change-of-scope nil)
+ (token-number 1)
+ (last-token-number (length phps-mode-lexer-tokens)))
;; Iterate through all buffer tokens from beginning to end
(dolist (item phps-mode-lexer-tokens)
@@ -74,18 +76,13 @@
(token-line-number (line-number-at-pos token-start t)))
;; Are we on a new line?
- (if (> token-line-number last-line-number)
+ (if (or (> token-line-number last-line-number)
+ (= token-number last-token-number))
(progn
;; Calculate indentation level at end of line
(setq nesting-end (+ round-bracket-level
square-bracket-level curly-bracket-level alternative-control-structure-level
inline-control-structure-level))
- ;; Is line ending indentation higher than line beginning
indentation?
- (when (> nesting-end nesting-start)
-
- ;; Increase indentation by one
- (setq column-level (1+ column-level)))
-
;; Is line ending indentation lesser than line beginning
indentation?
(when (< nesting-end nesting-start)
@@ -96,8 +93,7 @@
(when (and (= nesting-end nesting-start)
change-of-scope)
(setq column-level (1- column-level)))
-
-
+
;; Increase indent with one space inside doc-comment,
HEREDOC or NOWDOC
(if (or in-doc-comment in-heredoc)
(setq tuning-level 1)
@@ -109,6 +105,12 @@
(when (> last-line-number 0)
(puthash last-line-number `(,column-level ,tuning-level)
line-indents))
+ ;; Is line ending indentation higher than line beginning
indentation?
+ (when (> nesting-end nesting-start)
+
+ ;; Increase indentation by one
+ (setq column-level (1+ column-level)))
+
;; Calculate indentation level at start of line
(setq nesting-start (+ round-bracket-level
square-bracket-level curly-bracket-level alternative-control-structure-level
inline-control-structure-level))
@@ -233,7 +235,9 @@
;; Update last line number
(setq last-line-number token-line-number))
- ))
+ )
+
+ (setq token-number (1+ token-number)))
line-indents))
nil))
- [elpa] externals/phps-mode 16d8056 144/405: Foundation for new indentation tests completed, (continued)
- [elpa] externals/phps-mode 16d8056 144/405: Foundation for new indentation tests completed, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d380cd4 129/405: Updated readme, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3f08b86 128/405: Updated tracking of alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 52c502c 139/405: Improved logic for doc-comment tracking, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 1472273 136/405: Begun working on new approach to indentation calculation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9792f70 133/405: Cleaning up code gather point meta information, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode cc947a9 140/405: Added more tests for new indentation function, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d3e00f2 141/405: Starting on new function for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c68c7a0 131/405: Fixed issue were first-token-on-line was nil, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c4ee0c3 132/405: Added more failing tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0b3ced4 145/405: First test for new indentation function passes,
Stefan Monnier <=
- [elpa] externals/phps-mode 96588b5 142/405: More work on new indentation calculation functions, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9d6af11 157/405: More work on indentations, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e249124 152/405: Prevent negative indent, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 4a27c44 147/405: Added support for naming unit tests to better find failures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b852f5f 160/405: All tests for indentation passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode dfb0427 151/405: Added unit test for round and square bracket expressions, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7b8cea3 163/405: Added failing indentation test for class multiple implements, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a61ff64 134/405: Renamed function get-point-data to get-current-line-data for better semantics, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b99da6b 153/405: Starting using new indentation calculation for indentations, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6559760 166/405: Work on assignments and class declaration indentations, Stefan Monnier, 2019/07/13