[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dart-mode 8d83554 042/192: Properly indent lambdas.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dart-mode 8d83554 042/192: Properly indent lambdas. |
Date: |
Sun, 29 Aug 2021 11:01:47 -0400 (EDT) |
branch: elpa/dart-mode
commit 8d835544e33792794d5e1c2d6720cc26b9004160
Author: Nathan Weizenbaum <nweiz@google.com>
Commit: Nathan Weizenbaum <nweiz@google.com>
Properly indent lambdas.
---
dart-mode.el | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dart-mode.el b/dart-mode.el
index 25099da..a7c7404 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -200,7 +200,9 @@
(indent-tabs-mode . nil)
(fill-column . 80)
(c-offsets-alist . ((arglist-intro . +)
- (arglist-cont-nonempty . ++))))
+ (arglist-cont-nonempty . ++)
+ (statement-block-intro . dart-block-offset)
+ (block-close . dart-block-offset))))
"The default Dart styles.")
(c-add-style "dart" dart-c-style)
@@ -211,6 +213,20 @@
;;; CC indentation support
+(defun dart-block-offset (info)
+ "Calculate the correct indentation for inline functions.
+
+When indenting inline functions, we want to pretend that
+functions taking them as parameters essentially don't exist."
+ (destructuring-bind (syntax . anchor) info
+ (let ((arglist-count
+ (loop for (symbol . _) in c-syntactic-context
+ count (eq symbol 'arglist-cont-nonempty))))
+ (if (> arglist-count 0)
+ (- (* -1 c-basic-offset arglist-count)
+ (if (eq syntax 'block-close) c-basic-offset 0))
+ (if (eq syntax 'block-close) 0 '+)))))
+
(defun dart-in-block-p (syntax-guess)
"Return whether or not the immediately enclosing {} block is a code block.
The other option, of course, is a map literal.
- [nongnu] elpa/dart-mode b42c2ca 014/192: Another known bug., (continued)
- [nongnu] elpa/dart-mode b42c2ca 014/192: Another known bug., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 4d67ba8 017/192: Fix the closing comment., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 1473515 019/192: Bump to version 0.3 for release., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 06c2786 024/192: Bump version to 0.4., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 2410a15 025/192: Fix =>-style method indentation., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 9ee0bf1 028/192: Bump version to 0.5., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 67550e5 030/192: Fix indentation for try as well., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 4310054 038/192: Bump version to 0.6., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 464e07b 039/192: Get rid of a now-inapplicable known bug., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode cad31a5 040/192: Get basic ${} fontification working., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 8d83554 042/192: Properly indent lambdas.,
ELPA Syncer <=
- [nongnu] elpa/dart-mode 148f707 048/192: Add a couple known issues., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode f5fb993 049/192: Fix the case indentation., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 5c09eae 051/192: Add support for illusori's flymake-warn-line-regexp., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode b7dc54c 052/192: Bump version to 0.8., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode eca6432 058/192: Bump version to 0.10., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode a935c27 059/192: don't advise c-parse-state if c-parse-state-1 isn't defined., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 3b3992b 060/192: Merge pull request #8 from rginda/unadvise, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 079ecc2 062/192: Add support for Dart analysis server., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 88920ee 066/192: Bump version to 0.13., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode c54f014 069/192: Merge pull request #18 from hterkelsen/no_pty, ELPA Syncer, 2021/08/29