[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phpinspect b6978105e5 25/30: Fix: Don't discard first c
From: |
ELPA Syncer |
Subject: |
[elpa] externals/phpinspect b6978105e5 25/30: Fix: Don't discard first char after opening brace of class block |
Date: |
Sat, 31 Aug 2024 09:58:54 -0400 (EDT) |
branch: externals/phpinspect
commit b6978105e5d27ddd3682918e856a7689092382f5
Author: Hugo Thunnissen <devel@hugot.nl>
Commit: Hugo Thunnissen <devel@hugot.nl>
Fix: Don't discard first char after opening brace of class block
---
phpinspect-parser.el | 1 -
test/test-buffer.el | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/phpinspect-parser.el b/phpinspect-parser.el
index 728e546c2f..9e818e120a 100644
--- a/phpinspect-parser.el
+++ b/phpinspect-parser.el
@@ -716,7 +716,6 @@ static keywords with the same meaning as in a class block."
(phpinspect-defhandler class-block (start-token max-point)
"Handler for code blocks that cannot contain classes"
((regexp . "{"))
- (forward-char (length start-token))
(let* ((complete-block nil)
(continue-condition (lambda ()
(not (and (char-equal (char-after) ?})
diff --git a/test/test-buffer.el b/test/test-buffer.el
index e5bfa16c10..eb2474c6e5 100644
--- a/test/test-buffer.el
+++ b/test/test-buffer.el
@@ -738,3 +738,47 @@ class Bar {
(phpinspect-buffer-update-project-index buffer)
(should (= 1 (length (phpi-typedef-get-methods class))))))))
+
+
+(ert-deftest phpinspect-buffer-parse-incrementally-class-block-scope ()
+ (with-temp-buffer
+ (let* ((project (phpinspect--make-dummy-composer-project-with-code))
+ (buffer (phpinspect-make-buffer :-project project :buffer
(current-buffer))))
+
+ (insert "<?php class A { public function A() {} }")
+
+ (setq-local phpinspect-current-buffer buffer)
+ (add-hook 'after-change-functions #'phpinspect-after-change-function)
+ (let ((expected `(:root
+ (:class
+ (:declaration
+ (:word "class")
+ (:word "A"))
+ (:block
+ (:public
+ (:function
+ (:declaration
+ (:word "function")
+ (:word "A")
+ (:list))
+ (:block)))))))
+ (result (phpinspect-buffer-parse buffer 'no-interrupt)))
+
+ (should result)
+ (pp result)
+ (should (equal expected result))
+
+ (goto-char 17)
+ (delete-backward-char 1)
+ (message (buffer-string))
+ (setq result (phpinspect-buffer-parse buffer 'no-interrupt))
+ (pp result)
+ (should result)
+ (should (equal expected result))
+
+ (backward-char)
+ (insert " ")
+ (message (buffer-string))
+ (setq result (phpinspect-buffer-parse buffer 'no-interrupt))
+ (should result)
+ (should (equal expected result))))))
- [elpa] externals/phpinspect 870fdb519d 14/30: Optimize process of checking for/loading type dependencies, (continued)
- [elpa] externals/phpinspect 870fdb519d 14/30: Optimize process of checking for/loading type dependencies, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect eec48eb6ea 28/30: Add test for update of method names in buffers + fix bug in completion, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect f1066c3c7f 29/30: Remove debug statements, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 223ca2bf54 12/30: Implement use of traits in live-edited buffers, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect b11d017702 01/30: Correctly index the name by which a function return type was referenced as used type, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 692711e34d 20/30: Implement property cells for more reliable property inheritance modeling, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 5f00c9ad8b 22/30: Fix compilation errors and fix tests for phpinspect-imports.el, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 2e6b0e9d2f 15/30: Make handling of corrupt index more robust + convert regexp to constant, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 77bd3ebe90 27/30: Use `delete-char' instead of `delete-backward-char', ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect bf03a87c7f 17/30: Remove obsolete class test, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect b6978105e5 25/30: Fix: Don't discard first char after opening brace of class block,
ELPA Syncer <=
- [elpa] externals/phpinspect fe4f73661c 21/30: Make import removal configurable, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 5f44a51a75 16/30: Re-use last completion list when possible, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 9c0959a0df 11/30: Add some docstrings + a license header to phpinspect-typedef.el, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 52626b7091 18/30: Remove unused defun, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 4f85ef04a5 23/30: Remove debug statement, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 95a29a3982 30/30: Bump version to 2.0.0, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 9029072bc9 02/30: Fix bug in indexation of live edited buffer (function with preceding bareword in scope), ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 87b86812ff 04/30: Implement initial algorithm for indexation of traits, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 25f706077a 06/30: Add license header and `provide' statement, ELPA Syncer, 2024/08/31
- [elpa] externals/phpinspect 96ee3c4d2a 05/30: WIP: (method-cell) Basic infrastructure for nuanced method inheritance, ELPA Syncer, 2024/08/31