[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode 897c85a 197/459: imenu: Fix indexing of del
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode 897c85a 197/459: imenu: Fix indexing of delegates. |
Date: |
Sun, 22 Aug 2021 13:59:26 -0400 (EDT) |
branch: externals/csharp-mode
commit 897c85aef828f24148a782d591c7f70844627c39
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>
imenu: Fix indexing of delegates.
With or without namespace. Add tests.
This closes https://github.com/josteink/csharp-mode/issues/80.
---
csharp-mode-tests.el | 9 +++++++++
csharp-mode.el | 13 +++++++++++--
test-files/imenu-delegate-test.cs | 10 +++++-----
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index 98bda72..ea98ee7 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -234,6 +234,15 @@
"(method) AbstractMethod("
"(method) UnsafeCopy(")
+(def-imenutest imenu-parsing-supports-delegates
+ "./test-files/imenu-delegate-test.cs"
+ "delegate PromptCallback"
+ "delegate PromptStateCallback"
+ "delegate PromptStateCallback<T>"
+ "delegate Foobar.TargetCallback"
+ "delegate Foobar.TargetStateCallback"
+ "delegate Foobar.TargetStateCallback<T>")
+
(ert-deftest imenu-indexing-resolves-correct-container ()
(let* ((testcase-no-namespace '( ("class Global" . 10)
(("namespace_a" . 20) ("namespace_b" . 30))
diff --git a/csharp-mode.el b/csharp-mode.el
index c328299..1a3481b 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -1893,9 +1893,9 @@ to the beginning of the prior namespace.
return-type space
"\\("
generic-identifier
+ "\\)"
optional-space
parameter-list
- "\\)"
;; optional // or /* comment at end
optional-space
";") 1)
@@ -2113,10 +2113,19 @@ to the beginning of the prior namespace.
;; `helm-imenu', but there's nothing we can do about that.
;; The alternative is making it a menu with -1- submenu which
;; says "( top )" but that will be very clicky...
+
+ ;; before adding delegates, we need to pad the entry so that it
+ ;; matches the "<type> <name>" signature used by all the other
+ ;; imenu entries
+ (let ((delegates (cdr (assoc "delegate" index))))
+ (dolist (delegate delegates)
+ (setf (car delegate) (concat "delegate " (car delegate)))))
+
(dolist (type '("enum" "delegate"))
(dolist (item (cdr (assoc type index)))
(let ((item-name (csharp--imenu-get-class-name item namespaces)))
- (setq result (cons (cons item-name (cdr item)) result)))))
+ (setq result (cons (cons item-name (cdr item))
+ result)))))
;; sort individual sub-lists
(dolist (item result)
diff --git a/test-files/imenu-delegate-test.cs
b/test-files/imenu-delegate-test.cs
index 77d7a4b..3127958 100644
--- a/test-files/imenu-delegate-test.cs
+++ b/test-files/imenu-delegate-test.cs
@@ -1,12 +1,12 @@
using System;
-namespace Boo
+public delegate void PromptCallback( Mobile from, string text );
+public delegate void PromptStateCallback( Mobile from, string text, object
state );
+public delegate void PromptStateCallback<T>( Mobile from, string text, T state
);
+
+namespace Foobar
{
public delegate void TargetCallback( Mobile from, object targeted );
public delegate void TargetStateCallback( Mobile from, object targeted,
object state );
public delegate void TargetStateCallback<T>( Mobile from, object targeted,
T state );
}
-
-public delegate void PromptCallback( Mobile from, string text );
-public delegate void PromptStateCallback( Mobile from, string text, object
state );
-public delegate void PromptStateCallback<T>( Mobile from, string text, T state
);
- [elpa] externals/csharp-mode 73e7ed6 125/459: Merge pull request #53 from ymarkovitch/master, (continued)
- [elpa] externals/csharp-mode 73e7ed6 125/459: Merge pull request #53 from ymarkovitch/master, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode d01f22f 149/459: Imenu: fix interface-prefixed members, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode b8073ed 151/459: Imenu: correctly report namespace for all types, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ed030e7 152/459: Ensure test-cases don't overlap., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode c7932f9 156/459: Remove useless autoloads, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ee9125d 163/459: Fix looking-back warnings., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f9e95d1 167/459: Ensure tests reproduce fontification bugs., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ca394f1 188/459: imenu: Fix indexing of methods in test-file., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode c206dbc 191/459: extern is a modifier-keyword, not "other" keyword., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode a8d8ef8 195/459: imenu: Index delegates, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 897c85a 197/459: imenu: Fix indexing of delegates.,
ELPA Syncer <=
- [elpa] externals/csharp-mode fe3ca7e 200/459: Inline square-parenthesis detection., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f9122bb 208/459: Fix indentation for array collection initializers., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ebd67a1 209/459: Correctly indent nested generic object initializers, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 5b89db2 088/459: Imenu: Correctly handle default-values in param-lists., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 8ccafbc 092/459: remove unused rule and documentation, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0e333c3 090/459: fontify else, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f96cf8b 089/459: remove fontification of accessors and constructors, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode c097a34 093/459: add async as a function modifier, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode dd6c930 102/459: Merge pull request #43 from wasamasa/fix-major-mode-definition, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 55fe188 101/459: Use `define-derived-mode`, ELPA Syncer, 2021/08/22