[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 3718931 156/405: Basic tests for indentation
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 3718931 156/405: Basic tests for indentation calculation passes |
Date: |
Sat, 13 Jul 2019 10:00:04 -0400 (EDT) |
branch: externals/phps-mode
commit 371893128041ea5b44f2c85b1b882f8f42bb7a94
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Basic tests for indentation calculation passes
---
phps-mode-functions.el | 15 +++++++++------
phps-mode-test-functions.el | 1 -
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 4d701c0..b0bd25c 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -103,7 +103,7 @@
;; Decrement column
(if allow-custom-column-decrement
(progn
- (setq column-level (- nesting-end nesting-start))
+ (setq column-level (- column-level (-
nesting-start nesting-end)))
(setq allow-custom-column-increment nil))
(setq column-level (1- column-level))))
@@ -143,7 +143,7 @@
;; Increase indentation
(if allow-custom-column-increment
(progn
- (setq column-level (- nesting-end nesting-start))
+ (setq column-level (+ column-level (- nesting-end
nesting-start)))
(setq allow-custom-column-increment nil))
(setq column-level (1+ column-level))))
@@ -191,6 +191,8 @@
(when (and switch-curly-stack
(= curly-bracket-level (car switch-curly-stack)))
(setq curly-bracket-level (1- curly-bracket-level))
+ ;; (message "Found ending switch curly bracket")
+ (setq allow-custom-column-decrement t)
(pop switch-curly-stack))
(when first-token-on-line
@@ -206,6 +208,7 @@
;; (message "Found ending alternative token %s %s" token
alternative-control-structure-level)
(when (equal token 'T_ENDSWITCH)
+ (setq allow-custom-column-decrement t)
(setq alternative-control-structure-level (1-
alternative-control-structure-level)))
(when first-token-on-line
@@ -220,10 +223,10 @@
(if (string= token "{")
(when (equal after-special-control-structure-token
'T_SWITCH)
- (setq curly-bracket-level (1+ curly-bracket-level))
- (setq allow-custom-column-increment t)
;; (message "Opening switch, increase curly brackets to
%s" curly-bracket-level)
- (push curly-bracket-level switch-curly-stack))
+ (push curly-bracket-level switch-curly-stack)
+ (setq allow-custom-column-increment t)
+ (setq curly-bracket-level (1+ curly-bracket-level)))
;; Is it the start of an alternative control structure?
(if (string= token ":")
@@ -322,7 +325,7 @@
;; Decrement column
(if allow-custom-column-decrement
(progn
- (setq column-level (- nesting-end nesting-start))
+ (setq column-level (- column-level (- nesting-start
nesting-end)))
(setq allow-custom-column-increment nil))
(setq column-level (1- column-level))))
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index af254d9..3a2330a 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -81,7 +81,6 @@
(phps-mode-test-with-buffer
"<?php\nswitch ($condition) {\n case true:\n echo 'here';\n
echo 'here 2';\n case false:\n echo 'here 4';\n default:\n
echo 'here 3';\n}\n"
"Switch, case, default"
- (message "tokens %s" phps-mode-lexer-tokens)
(should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1
0)) (7 (2 0)) (8 (1 0)) (9 (2 0)) (10 (0 0)))
(phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
;; TODO NOWDOC, HEREDOC
- [elpa] externals/phps-mode f789468 172/405: Took notes of new indentation tests, (continued)
- [elpa] externals/phps-mode f789468 172/405: Took notes of new indentation tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 20e77aa 181/405: Removed debug output, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 321803a 182/405: Line indents are now cleaning on buffer changes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 38bcabb 176/405: Improved detection of assignment ends in function optional arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f1236e2 169/405: Unit tests for indentation calculation for multi-line strings passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 105fece 149/405: New indent calculation for inline syntax passes test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0a32b17 161/405: Improved calculation for indentation for multi-line assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b2eac4d 154/405: More work on switch case default, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6b5a5c3 155/405: More work on calculating indentations, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ce2d4bd 148/405: New indentation calculation function passes alternative, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3718931 156/405: Basic tests for indentation calculation passes,
Stefan Monnier <=
- [elpa] externals/phps-mode 13e9148 159/405: Indentation unit test for assignment is passing, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b5c64c1 162/405: Added failing tests for HEREDOC and NOWDOC assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f283e4b 173/405: Added new failing unit tests for multiple-lines IF and single line class declaration, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 59474ea 180/405: Improved debugging messages, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9659ab4 174/405: Added failing test for doc-comments are namespace and class, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c5d8ec6 168/405: Indentation calculation for class implement working, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f93765d 184/405: Improved code structure of indentation were nesting start and end equals, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2af8abd 206/405: Made TODO notes in algorithm, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7a538ac 200/405: Tests for alternative control structures passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 79e61f4 171/405: Fixed indentation with assignment lines on only one line, Stefan Monnier, 2019/07/13