emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/csharp-mode b11fcda 147/459: Imenu: Add support for int


From: ELPA Syncer
Subject: [elpa] externals/csharp-mode b11fcda 147/459: Imenu: Add support for interface-prefixed methods.
Date: Sun, 22 Aug 2021 13:59:15 -0400 (EDT)

branch: externals/csharp-mode
commit b11fcda620aed46fbd4e702ee565448af26a1b25
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>

    Imenu: Add support for interface-prefixed methods.
    
    This fixes https://github.com/josteink/csharp-mode/issues/65
---
 csharp-mode-tests.el                        | 9 +++++++++
 csharp-mode.el                              | 1 +
 test-files/imenu-interface-property-test.cs | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index c24cea4..dde2d32 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -212,6 +212,15 @@
     (should (string-match-p "prop IImenuTest.InterfaceString" imenu-items))
     (kill-buffer buffer)))
 
+(ert-deftest imenu-parsing-supports-explicit-interface-methods ()
+  (let* ((find-file-hook nil) ;; avoid vc-mode file-hooks when opening!
+         (buffer         (find-file-read-only 
"./test-files/imenu-interface-property-test.cs"))
+         (imenu-index    (csharp--imenu-create-index-helper nil "" t t)) ;; 
same line as in `csharp-imenu-create-index'.
+         (class-entry    (cl-caddr imenu-index))
+         (class-entries  (cdr class-entry))
+         (imenu-items    (mapconcat 'car class-entries " ")))
+    (should (string-match-p "method string MethodName" imenu-items))
+    (kill-buffer buffer)))
 (ert-deftest imenu-parsing-supports-namespace ()
   (let* ((find-file-hook nil) ;; avoid vc-mode file-hooks when opening!
          (buffer         (find-file-read-only 
"./test-files/imenu-namespace-test.cs"))
diff --git a/csharp-mode.el b/csharp-mode.el
index 134a035..f8e67e9 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -1485,6 +1485,7 @@ 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]+"
+         "\\(?:[A-Za-z_][[:alnum:]_]*\\.\\)*"         ;; possible prefix 
interface
          "\\([[:alpha:]_][[:alnum:]_]*"               ;; 3. begin name of func
          "\\(?:<\\(?:[[:alpha:]][[:alnum:]]*\\)\\(?:[, 
]+[[:alpha:]][[:alnum:]]*\\)*>\\)?"  ;; (with optional generic type parameter(s)
          "\\)"                                        ;; 3. end of name of func
diff --git a/test-files/imenu-interface-property-test.cs 
b/test-files/imenu-interface-property-test.cs
index 4818d56..2b98460 100644
--- a/test-files/imenu-interface-property-test.cs
+++ b/test-files/imenu-interface-property-test.cs
@@ -8,4 +8,9 @@ public interface IImenuTest
 public class ImenuTest : IImenuTest
 {
     string IImenuTest.InterfaceString { get { return "i"; }}
+
+    string IIMenuTest.MethodName(string param1, int param2)
+    {
+        
+    }
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]