[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode a8d8ef8 195/459: imenu: Index delegates
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode a8d8ef8 195/459: imenu: Index delegates |
Date: |
Sun, 22 Aug 2021 13:59:25 -0400 (EDT) |
branch: externals/csharp-mode
commit a8d8ef8cba289ad4b87b1dc9637fc6994d186185
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>
imenu: Index delegates
Partially addresses https://github.com/josteink/csharp-mode/issues/80.
---
csharp-mode.el | 30 ++++++++++++++++++++++++------
test-files/imenu-delegate-test.cs | 12 ++++++++++++
2 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/csharp-mode.el b/csharp-mode.el
index fbbcaff..c328299 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -1778,7 +1778,7 @@ to the beginning of the prior namespace.
(defconst csharp--imenu-expression
(let* ((single-space "[ \t\n\r\f\v]")
(optional-space (concat single-space "*"))
- (bol (concat "^" optional-space))
+ (bol "^[ \t]*") ;; BOL shouldnt accept
lineshift.
(space (concat single-space "+"))
(access-modifier (regexp-opt '( "public" "private" "protected"
"internal"
"static" "sealed" "partial"
"override" "virtual"
@@ -1882,6 +1882,23 @@ to the beginning of the prior namespace.
optional-space
;; abstract/extern methods are terminated with ;
";") 1)
+ ;; delegates are almost like abstract methods, so pick them up here
+ (list "delegate"
+ (concat bol
+ ;; we MUST require modifiers, or else we cannot
reliably
+ ;; identify declarations, without also dragging in
lots of
+ ;; if statements and what not.
+ access-modifier-list "+"
+ "delegate" space
+ return-type space
+ "\\("
+ generic-identifier
+ optional-space
+ parameter-list
+ "\\)"
+ ;; optional // or /* comment at end
+ optional-space
+ ";") 1)
(list "prop"
(concat bol
;; must require access modifiers, or else we
@@ -2089,16 +2106,17 @@ to the beginning of the prior namespace.
(name (car (last type))))
(csharp--imenu-append-items-to-menu result key name index classes
namespaces)))
- ;; add enums to main result list, as own items.
+ ;; add enums and delegates to main result list, as own items.
;; We don't support nested types. EOS.
;;
- ;; This has the issue that it gets reported as "function" in
+ ;; This has the issue that they get reported as "function" in
;; `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...
- (dolist (enum (cdr (assoc "enum" index)))
- (let ((enum-name (csharp--imenu-get-class-name enum namespaces)))
- (setq result (cons (cons enum-name (cdr enum)) result))))
+ (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)))))
;; sort individual sub-lists
(dolist (item result)
diff --git a/test-files/imenu-delegate-test.cs
b/test-files/imenu-delegate-test.cs
new file mode 100644
index 0000000..77d7a4b
--- /dev/null
+++ b/test-files/imenu-delegate-test.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Boo
+{
+ 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 0f39f84 122/459: Apply bug#18845 workaround, (continued)
- [elpa] externals/csharp-mode 0f39f84 122/459: Apply bug#18845 workaround, ELPA Syncer, 2021/08/22
- [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 <=
- [elpa] externals/csharp-mode 897c85a 197/459: imenu: Fix indexing of delegates., ELPA Syncer, 2021/08/22
- [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