[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode ae1e36c 132/459: Tentative fix for imenu an
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode ae1e36c 132/459: Tentative fix for imenu and generics |
Date: |
Sun, 22 Aug 2021 13:59:12 -0400 (EDT) |
branch: externals/csharp-mode
commit ae1e36c2276aef8b079905f41f8382e5c96c85b8
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>
Tentative fix for imenu and generics
Fixes https://github.com/josteink/csharp-mode/issues/51
---
csharp-mode-tests.el | 16 ++++++++++++++++
csharp-mode.el | 4 +++-
test-files/imenu-generics-test.cs | 19 +++++++++++++++++++
3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index 0fb7661..10cfb37 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -166,6 +166,22 @@
(result (csharp--imenu-remove-param-names-from-paramlist
test-value)))
(should (equal expected-value result)))))
+(ert-deftest imenu-parsing-supports-generic-parameters ()
+ (let* ((find-file-hook '()) ;; avoid vc-mode file-hooks when opening!
+ (buffer (find-file-read-only
"./test-files/imenu-generics-test.cs"))
+ (ignored (beginning-of-buffer))
+ (imenu-index (csharp--imenu-create-index-helper nil "" t t)) ;;
same line as in `csharp-imenu-create-index'.
+ (class-entry (cadr imenu-index))
+ (class-entries (cdr class-entry))
+ (class-items (mapcar 'car class-entries))
+ (all-in-one (cl-reduce 'concat class-items)))
+
+ ;; ("(top)" "method void NoGeneric(this IAppBuilder, params object[])"
"method void OneGeneric<T>(this IAppBuilder, params object[])" "method void
TwoGeneric<T1,T2>(this IAppBuilder, params object[])" "(bottom)")
+ (should (string-match-p "NoGeneric" all-in-one))
+ (should (string-match-p "OneGeneric<T>" all-in-one))
+ (should (string-match-p "TwoGeneric<T1,T2>" all-in-one))
+ (kill-buffer buffer)))
+
(defvar csharp-hook1 nil)
(defvar csharp-hook2 nil)
diff --git a/csharp-mode.el b/csharp-mode.el
index 21ea1e5..75927b3 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -1483,7 +1483,9 @@ Most other csharp functions are not instrumented.
"\\(?:override[ \t\n\r\f\v]+\\)?" ;; optional
"\\([[:alpha:]_][^\t\(\n]+\\)" ;; 2. return type -
possibly generic
"[ \t\n\r\f\v]+"
- "\\([[:alpha:]_][[:alnum:]_]*\\)" ;; 3. name of func
+ "\\([[:alpha:]_][[:alnum:]_]*" ;; 3. begin name of func
+ "\\(?:<\\(?:[[:alpha:]][[:alnum:]]*[, ]?\\)*>\\)?" ;; (with optional
generic type parameter(s)
+ "\\)" ;; 3. end of name of func
"[ \t\n\r\f\v]*"
"\\(\([^\)]*\)\\)" ;; 4. params w/parens
"[ \t\n\r\f\v]*"
diff --git a/test-files/imenu-generics-test.cs
b/test-files/imenu-generics-test.cs
new file mode 100644
index 0000000..cd6fec1
--- /dev/null
+++ b/test-files/imenu-generics-test.cs
@@ -0,0 +1,19 @@
+using System;
+
+class ImenuMatcherTests
+{
+ private void OneGeneric<T>(this IAppBuilder builder, params object[] args)
+ {
+ Console.WriteLine("TODO: something");
+ }
+
+ private void TwoGeneric<T1,T2>(this IAppBuilder builder, params object[]
args)
+ {
+ Console.WriteLine("TODO: something");
+ }
+
+ private void NoGeneric(this IAppBuilder builder, params object[] args)
+ {
+ Console.WriteLine("TODO: something");
+ }
+}
- [elpa] externals/csharp-mode 628a4e2 248/459: Added testcases for region fontification., (continued)
- [elpa] externals/csharp-mode 628a4e2 248/459: Added testcases for region fontification., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 79e0a60 256/459: New simpler build based on Cask, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode bf613f8 274/459: Handle failure correctly, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 5d0ffaa 113/459: Use cl-lib equivalents for incf and decf, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 6af6f88 111/459: Fix fontification tests., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 7247a27 115/459: Prefix set-difference from cl.el, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 71b0e96 116/459: Fix errors and warnings in unit-tests., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 56a9a87 117/459: Fix backwards compatibility and broken CI-build., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode c446400 118/459: Remove obsolete comment, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 829ad4d 120/459: Another stab at fixing the CI., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ae1e36c 132/459: Tentative fix for imenu and generics,
ELPA Syncer <=
- [elpa] externals/csharp-mode 1f292eb 141/459: Fixed fontification hanging on a large file (3kLOC)., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ee817b0 143/459: Added a test for imenu indexing of explicit interface properties., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 7c196b7 144/459: Added a minimal imenu namespace test., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ffa8c3e 145/459: Fixed a test to use cl-caddr, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f08f0ee 154/459: Improved test-structure with less redundant information (and thus errors). Prepare for improved tests., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 7b8fe05 160/459: Fix version-history based on actual git-tags., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 838727a 173/459: Ensure we get Emacs 24.4 for CI., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 405af61 076/459: Fix parsing of build-logs., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 1574d3e 085/459: Merge pull request #32 from binki/master, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f1a2e06 110/459: Add unit-test for fontification of compiler-directives., ELPA Syncer, 2021/08/22