branch: externals/phps-mode commit bf633d2d60859e196a1094a0097aae8c8f973699 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Added test for indent of final line of doc comment block --- phps-functions.el | 8 +++++--- phps-test-functions.el | 10 +++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/phps-functions.el b/phps-functions.el index 8b20457..8115cf1 100644 --- a/phps-functions.el +++ b/phps-functions.el @@ -113,7 +113,10 @@ (when (string= major-mode "phps-mode") (when (and (not phps-mode/buffer-changes--start) (boundp 'phps-mode/idle-interval)) - (run-with-idle-timer phps-mode/idle-interval nil #'phps-mode/run-incremental-lex)) + (run-with-idle-timer phps-mode/idle-interval nil #'phps-mode/lex--RUN) + ;; TODO Maybe use incremental lexer once it's working + ;; (run-with-idle-timer phps-mode/idle-interval nil #'phps-mode/run-incremental-lex) + ) (when (or (not phps-mode/buffer-changes--start) (< start phps-mode/buffer-changes--start)) ;; (message "Setting %s to %s" phps-mode/buffer-changes--start start) @@ -172,8 +175,7 @@ (")" (setq start-parenthesis-level (- start-parenthesis-level 1))) (_))) - (when (and (> token-end line-end) - (< token-start line-beginning) + (when (and (< token-start line-beginning) (eq token 'T_DOC_COMMENT)) (setq line-in-doc-comment t)) diff --git a/phps-test-functions.el b/phps-test-functions.el index 17cced3..1ead7e7 100644 --- a/phps-test-functions.el +++ b/phps-test-functions.el @@ -108,6 +108,14 @@ (should (equal buffer-contents "<?php\n/**\n* My first line\n* My second line\n**/\n")))) (phps-mode/with-test-buffer + "<?php\n/**\n* My first line\n* My second line\n**/\n" + (goto-char 46) + (phps-mode/indent-line) + ;; (message "Tokens %s point %s" phps-mode/lexer-tokens (point)) + (let ((buffer-contents (buffer-substring-no-properties (point-min) (point-max)))) + (should (equal buffer-contents "<?php\n/**\n* My first line\n* My second line\n **/\n")))) + + (phps-mode/with-test-buffer "<?php\n$variable = array(\n'random4');\n$variable = true;\n" (goto-char 29) (phps-mode/indent-line) @@ -184,7 +192,7 @@ (phps-mode/with-test-buffer "<?php /**\n * My first line\n * My second line\n **/" (goto-char 50) - (should (equal (list (list t 0 0 0 nil nil) (list t 0 0 0 nil nil)) (phps-mode/get-point-data)))) + (should (equal (list (list t 0 0 0 nil t) (list t 0 0 0 nil t)) (phps-mode/get-point-data)))) (phps-mode/with-test-buffer "<?php\n$variable = array(\n'random4');\n$variable = true;\n"