[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 36a4b64 222/405: Added lost test for token-le
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 36a4b64 222/405: Added lost test for token-less lines again |
Date: |
Sat, 13 Jul 2019 10:00:17 -0400 (EDT) |
branch: externals/phps-mode
commit 36a4b64a8d5f9e500db3f8e925c9b497a215b53f
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Added lost test for token-less lines again
---
phps-mode-functions.el | 27 ++++++++++++++-------------
phps-mode-test-functions.el | 2 +-
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 7555c93..cd7af95 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -420,17 +420,6 @@
;; ;; Start indentation might differ from ending
indentation in cases like } else {
(setq column-level-start column-level)
-
- ;; Indent token-less lines here in between last tokens
if distance is more than 1 line
- (when (and (> next-token-start-line-number (1+
token-start-line-number))
- (not (equal token 'T_CLOSE_TAG)))
- (let ((token-line-number-diff (1- (-
token-start-line-number next-token-start-line-number))))
- (while (>= token-line-number-diff 0)
- (puthash (- token-start-line-number
token-line-number-diff) `(,column-level-start ,tuning-level) line-indents)
- ;; (message "Saved line %s indent %s %s" (-
token-end-line-number token-line-number-diff) column-level tuning-level)
- (setq token-line-number-diff (1-
token-line-number-diff)))))
-
-
;; Support temporarily pre-indent
(when temp-pre-indent
(setq column-level-start temp-pre-indent)
@@ -445,7 +434,6 @@
;; Save line indent
-
(when phps-mode-functions-verbose
(message "Process line ending. nesting: %s-%s,
line-number: %s-%s, indent: %s.%s, token: %s" nesting-start nesting-end
token-start-line-number token-end-line-number column-level-start tuning-level
token))
@@ -467,7 +455,6 @@
(when nesting-stack
(setq nesting-stack-end (car (cdr (car
nesting-stack)))))
- ;; Increase indentation
(if allow-custom-column-increment
(progn
(setq column-level (+ column-level (-
nesting-end nesting-start)))
@@ -509,6 +496,20 @@
(setq tuning-level 0)))
+ ;; Indent token-less lines here in between last tokens
if distance is more than 1 line
+ (when (and (> next-token-start-line-number (1+
token-end-line-number))
+ (not (equal token 'T_CLOSE_TAG)))
+
+ (when phps-mode-functions-verbose
+ (message "\nDetected token-less lines between %s and
%s, should have indent: %s\n" token-end-line-number
next-token-start-line-number column-level))
+
+ (let ((token-line-number-diff (1- (-
next-token-start-line-number token-end-line-number))))
+ (while (>= token-line-number-diff 0)
+ (puthash (- next-token-start-line-number
token-line-number-diff) `(,column-level ,tuning-level) line-indents)
+ ;; (message "Saved line %s indent %s %s" (-
token-end-line-number token-line-number-diff) column-level tuning-level)
+ (setq token-line-number-diff (1-
token-line-number-diff)))))
+
+
;; ;; When nesting decreases but ends with a nesting
increase, increase indent by one
;; (when (and (< nesting-end nesting-start)
;; line-contained-nesting-increase)
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 59a92f8..195567f 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -276,7 +276,7 @@
"<html><head><title><?php if ($myCondition) {\n if ($mySeconCondition)
{\n echo $title2;\n\n } ?></title><body>Bla bla</body></html>"
"Mixed HTML/PHP with if expression and token-less lines"
;; (message "Tokens: %s" phps-mode-lexer-tokens)
- (should (equal '((1 (0 0)) (2 (1 0)) (3 (2 0)) (4 (2 0)) (5 (1 0)))
(phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
+ (should (equal '((1 (0 0)) (2 (1 0)) (3 (2 0)) (4 (2 0)) (5 (1 0)))
(phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
(phps-mode-test-with-buffer
"<html><head><title><?php\nif ($myCondition) {\n if ($mySecondCondition)
{\n echo $title;\n } else if ($mySecondCondition) {\n echo
$title4;\n } else {\n echo $title2;\n echo $title3;\n }\n}
?></title><body>Bla bla</body></html>"
- [elpa] externals/phps-mode 5f445cd 229/405: Fixed indentation for while expressions, (continued)
- [elpa] externals/phps-mode 5f445cd 229/405: Fixed indentation for while expressions, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode eb0ee5e 236/405: Updated README with imenu-support, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 811c499 220/405: New algorithm now works for switch, case syntax, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d2e5a03 228/405: Updated indentation algorithm document and README, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 1aa0f90 238/405: Typo in README, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode da1cfd5 231/405: Adding failing lexer test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e6a8944 241/405: Started work on a lexer bug with expressions inside double quoted strings, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0c49d6d 243/405: Removed debugging output, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 95ac15a 245/405: Imenu index now handles class extends and implements, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 67233ef 213/405: Fixed indent algorithm for multi-line strings, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 36a4b64 222/405: Added lost test for token-less lines again,
Stefan Monnier <=
- [elpa] externals/phps-mode 70f2d46 242/405: Fixed lexer issue with multiple expressions inside double-quoted string, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0286660 224/405: Indentation passes new tests for concatenated strings, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f05d40a 230/405: Tests for lexer passes again after close_tag modification, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 1bc5713 227/405: New tests for concatenation passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c71a97d 178/405: Started on refactored indentation calculation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8bb3918 249/405: Clean-up of unit test logging, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9201d1c 246/405: Imenu index now handles functions with optional arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2c3239a 187/405: Adding new failing tests for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d9a0119 183/405: Optimized indentation code by removing unused variables, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a0cbcd1 186/405: More work on indentation of multi-line IF-expressions, Stefan Monnier, 2019/07/13