branch: externals/phps-mode
commit 502a42b5c0cd59d6913f06fb6e0bd4bfcd4822fe
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Improved indentation around doc-comments
---
phps-mode-indent.el | 63 +++++++++++++++++++++++++++++++++--------------------
1 file changed, 39 insertions(+), 24 deletions(-)
diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index cf1387940f..a00d7b65d9 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -1078,6 +1078,45 @@
new-indentation
(- new-indentation tab-width)))
+ ;; LINE AFTER STARTING DOC-COMMENT
+ ;; /**
+ ;; *
+ ((= previous-bracket-level 1)
+ (setq
+ match-type
+ 'line-after-opening-doc-comment)
+ (setq
+ new-indentation
+ (+ new-indentation 1)))
+
+ ;; LINE AFTER ENDING OF DOC-COMMENT
+ ;; /**
+ ;; *
+ ;; */
+ ;; echo 'here';
+ ((= previous-bracket-level -1)
+ (setq
+ match-type
+ 'line-after-ending-of-doc-comment)
+ (setq
+ new-indentation
+ (1- new-indentation)))
+
+ ;; LINE AFTER CONTINUATION OF DOC-COMMENT
+ ;; /**
+ ;; * here
+ ;; * there
+ ((and
+ (string-match-p
+ "^[\t ]*\\*"
+ previous-line-string)
+ (string-match-p
+ "^[\t ]*/?\\*"
+ previous2-line-string))
+ (setq
+ match-type
+ 'line-after-continuation-of-doc-comment))
+
;; LINE AFTER LINE ENDING WITH COMMA
;; return array(
;; '' => __(
@@ -1220,30 +1259,6 @@
new-indentation
(+ new-indentation tab-width)))
- ;; LINE AFTER ENDING OF DOC-COMMENT
- ;; /**
- ;; *
- ;; */
- ;; echo 'here';
- ((= previous-bracket-level -1)
- (setq
- match-type
- 'line-after-ending-of-doc-comment)
- (setq
- new-indentation
- (1- new-indentation)))
-
- ;; LINE AFTER STARTING DOC-COMMENT
- ;; /**
- ;; *
- ((= previous-bracket-level 1)
- (setq
- match-type
- 'line-after-opening-doc-comment)
- (setq
- new-indentation
- (+ new-indentation 1)))
-
;; LINE AFTER LINE THAT ENDS AND STARTS A BRACKET BLOCK
;; ) {
;; echo 'here'