[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode bd881cd 303/459: Add a little better heuris
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode bd881cd 303/459: Add a little better heuristics to vsemi-p |
Date: |
Sun, 22 Aug 2021 13:59:49 -0400 (EDT) |
branch: externals/csharp-mode
commit bd881cd345652e3fbd28d05a1109c52483c287e7
Author: Theodor Thornhill <theodor.thornhill@frende.no>
Commit: Theodor Thornhill <theodor.thornhill@frende.no>
Add a little better heuristics to vsemi-p
The earlier implementation was indenting things like this:
resource.DoStuff(new Something("a", "b"));
resource.DoStuff(new Something("c", "d"));
Now we get this behaviour:
resource.DoStuff(new Something("a", "b"));
resource.DoStuff(new Something("c", "d"));
And still keep the csharp specific object inits like these:
yield return new Foo<bar>
{
a,
b,
c
};
new Foo<Bar>
{
a,
b,
c
};
---
csharp-mode.el | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/csharp-mode.el b/csharp-mode.el
index f488554..bc8ae8a 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -196,17 +196,24 @@
(defun csharp-at-vsemi-p (&optional pos)
(if pos (goto-char pos))
- (or (and (eq (char-before) ?\])
- (save-excursion
- (c-backward-sexp)
- (looking-at "\\[")))
+ (or (and
+ ;; Heuristics to find attributes
+ (eq (char-before) ?\])
+ (save-excursion
+ (c-backward-sexp)
+ (looking-at "\\[")))
(and
+ ;; Heuristics to find object initializers
(save-excursion
+ ;; Next non-whitespace character should be '{'
(c-forward-syntactic-ws)
(char-after ?{))
(save-excursion
+ ;; 'new' should be part of the line
(beginning-of-line)
- (looking-at ".*new.*")))))
+ (looking-at ".*new.*"))
+ ;; Line should not already be terminated
+ (not (eq (char-after) ?\;)))))
(c-lang-defconst c-at-vsemi-p-fn
csharp 'csharp-at-vsemi-p)
- [elpa] externals/csharp-mode 15bc3cb 326/459: Add support for dotnet test failures., (continued)
- [elpa] externals/csharp-mode 15bc3cb 326/459: Add support for dotnet test failures., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f4a0693 328/459: Richer font highlighting, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 82bcec9 329/459: Add missing LinQ keywords, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 91c0f3c 330/459: Extract type matcher into defconst, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 098aba3 334/459: Fix improper handling of "new" in buffers., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode fa2e596 348/459: Update README.org, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 61bf8e5 352/459: Update build.yml, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 2fe22ec 363/459: Update build.yml, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode a6caa85 369/459: xUnit failures: Handle actual/expected output before stack-trace., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 134eeb6 289/459: Complete rework, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode bd881cd 303/459: Add a little better heuristics to vsemi-p,
ELPA Syncer <=
- [elpa] externals/csharp-mode 37f2441 313/459: Add 'nameof' and 'is' to 'other kwds', ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode fbcb363 315/459: Make sure attributes are not arrays and new has whitespace, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode c7bdaeb 320/459: Fix string fontification on emacs 27.1, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 3846c49 333/459: Move regexes and add eval-and-compile, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 9fa77ac 336/459: Use 'c-default-style' instead of 'c-set-style', ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 352d90e 337/459: Set c-default-style globally, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 71b833d 342/459: Add fontification for nameof and catch with only type, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 53e9e05 343/459: Merge pull request #188 from josteink/new-fontification, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 1d02407 344/459: Fix annoyance: Rename csharp-menu to csharp-mode-menu., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode aa57925 347/459: Add badges to README, ELPA Syncer, 2021/08/22