@@ -1778,7 +1778,7 @@ to the beginning of the prior namespace.
17781778(defconst csharp--imenu-expression
17791779 (let* ((single-space " [ \t\n\r\f\v ]" )
17801780 (optional-space (concat single-space " *" ))
1781- (bol ( concat " ^ " optional-space))
1781+ (bol " ^[ \t ]* " ) ; ; BOL shouldnt accept lineshift.
17821782 (space (concat single-space " +" ))
17831783 (access-modifier (regexp-opt '( " public" " private" " protected" " internal"
17841784 " static" " sealed" " partial" " override" " virtual"
@@ -1882,6 +1882,23 @@ to the beginning of the prior namespace.
18821882 optional-space
18831883 ; ; abstract/extern methods are terminated with ;
18841884 " ;" ) 1 )
1885+ ; ; delegates are almost like abstract methods, so pick them up here
1886+ (list " delegate"
1887+ (concat bol
1888+ ; ; we MUST require modifiers, or else we cannot reliably
1889+ ; ; identify declarations, without also dragging in lots of
1890+ ; ; if statements and what not.
1891+ access-modifier-list " +"
1892+ " delegate" space
1893+ return-type space
1894+ " \\ ("
1895+ generic-identifier
1896+ optional-space
1897+ parameter-list
1898+ " \\ )"
1899+ ; ; optional // or /* comment at end
1900+ optional-space
1901+ " ;" ) 1 )
18851902 (list " prop"
18861903 (concat bol
18871904 ; ; must require access modifiers, or else we
@@ -2089,16 +2106,17 @@ to the beginning of the prior namespace.
20892106 (name (car (last type))))
20902107 (csharp--imenu-append-items-to-menu result key name index classes namespaces)))
20912108
2092- ; ; add enums to main result list, as own items.
2109+ ; ; add enums and delegates to main result list, as own items.
20932110 ; ; We don't support nested types. EOS.
20942111 ; ;
2095- ; ; This has the issue that it gets reported as "function" in
2112+ ; ; This has the issue that they get reported as "function" in
20962113 ; ; `helm-imenu' , but there's nothing we can do about that.
20972114 ; ; The alternative is making it a menu with -1- submenu which
20982115 ; ; says "( top )" but that will be very clicky...
2099- (dolist (enum (cdr (assoc " enum" index)))
2100- (let ((enum-name (csharp--imenu-get-class-name enum namespaces)))
2101- (setq result (cons (cons enum-name (cdr enum)) result))))
2116+ (dolist (type '(" enum" " delegate" ))
2117+ (dolist (item (cdr (assoc type index)))
2118+ (let ((item-name (csharp--imenu-get-class-name item namespaces)))
2119+ (setq result (cons (cons item-name (cdr item)) result)))))
21022120
21032121 ; ; sort individual sub-lists
21042122 (dolist (item result)
0 commit comments