emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/dart-mode f86416b 035/192: Handle indentation in construct


From: ELPA Syncer
Subject: [nongnu] elpa/dart-mode f86416b 035/192: Handle indentation in constructors with initializer lists.
Date: Sun, 29 Aug 2021 11:01:45 -0400 (EDT)

branch: elpa/dart-mode
commit f86416bbf0e600fc88a0463c1ba2ec8c45c3dd84
Author: Nathan Weizenbaum <nweiz@google.com>
Commit: Nathan Weizenbaum <nweiz@google.com>

    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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]