branch: elpa/dart-mode
commit f86416bbf0e600fc88a0463c1ba2ec8c45c3dd84
Author: Nathan Weizenbaum <[email protected]>
Commit: Nathan Weizenbaum <[email protected]>
Handle indentation in constructors with initializer lists.
---
dart-mode.el | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/dart-mode.el b/dart-mode.el
index d4b999f..959067d 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -244,6 +244,17 @@ SYNTAX-GUESS is the output of `c-guess-basic-syntax'."
(beginning-of-line)
(or
+ ;; Handle indentation in a constructor with an initializer on a
+ ;; separate line.
+ (when (memq type '(defun-block-intro inline-close))
+ (save-excursion
+ (c-safe
+ (goto-char (cadr syntax))
+ (when (= (char-after) ?:)
+ (c-beginning-of-statement-1)
+ (setq ad-return-value `((,type ,(point))))
+ t))))
+
;; Handle array literal indentation
(when (memq type
'(arglist-intro
@@ -282,6 +293,14 @@ SYNTAX-GUESS is the output of `c-guess-basic-syntax'."
(setq ad-return-value `((brace-list-entry ,(point))))
t))))))))))
+(defadvice c-inside-bracelist-p (after dart-inside-bracelist-p activate)
+ ;; This function is only called within c-guess-basic-syntax. Since we do all
+ ;; out brace-list detection in our advice, we just never report being in a
+ ;; bracelist there.
+ (when (c-major-mode-is 'dart-mode)
+ (setq ad-return-value nil))
+ )
+
;;; Boilerplate font-lock piping