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

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

[elpa] externals/csharp-mode b8073ed 151/459: Imenu: correctly report na


From: ELPA Syncer
Subject: [elpa] externals/csharp-mode b8073ed 151/459: Imenu: correctly report namespace for all types
Date: Sun, 22 Aug 2021 13:59:16 -0400 (EDT)

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

    Imenu: correctly report namespace for all types
    
    Previously interfaces would not get their containing namespace included
    in imenu index-name. Same applied to enums.
    
    These changes are preparations for adressing
    https://github.com/josteink/csharp-mode/issues/60.
---
 csharp-mode-tests.el               |  9 +++++++++
 csharp-mode.el                     | 19 +++++++++++--------
 test-files/imenu-namespace-test.cs | 11 +++++++++++
 3 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index 6a0b128..8614bdc 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -223,6 +223,15 @@
          (ns-item        (car ns-entry)))
     (should (string-match-p "namespace ImenuTest" ns-item))))
 
+(def-imenutest imenu-parsing-provides-types-with-namespace-names
+  "./test-files/imenu-namespace-test.cs" imenu-index
+  (let* ((ns-entry       (cadr imenu-index))
+         (ns-items       (cdr ns-entry))
+         (imenu-items    (mapconcat 'car ns-items " ")))
+    (should (string-match-p "interface ImenuTest.ImenuTestInterface" 
imenu-items))
+    (should (string-match-p "class ImenuTest.ImenuTestClass" imenu-items))
+    (should (string-match-p "enum ImenuTest.ImenuTestEnum" imenu-items))))
+
 (defvar csharp-hook1 nil)
 (defvar csharp-hook2 nil)
 
diff --git a/csharp-mode.el b/csharp-mode.el
index aa22c24..42c3c26 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -2448,14 +2448,17 @@ more open-curlies are found.
                 (csharp--on-enum-open-curly-p))
             (setq consider-namespaces nil
                   consider-usings nil
-                  this-menu
-                  (append this-menu
-                          (list
-                           (cons (concat
-                                  (match-string-no-properties 1) ;; thing 
flavor
-                                  " "
-                                  (match-string-no-properties 2)) ;; intf name
-                                 (match-beginning 1)))))
+                  container-name (if parent-ns
+                                     (concat parent-ns ".")
+                                   nil)
+                  this-menu (append this-menu
+                                    (list
+                                     (cons (concat
+                                            (match-string-no-properties 1) ;; 
thing flavor
+                                            " "
+                                            container-name
+                                            (match-string-no-properties 2)) ;; 
intf name
+                                           (match-beginning 1)))))
             (forward-sexp 1))
 
 
diff --git a/test-files/imenu-namespace-test.cs 
b/test-files/imenu-namespace-test.cs
index 3411281..1a922ca 100644
--- a/test-files/imenu-namespace-test.cs
+++ b/test-files/imenu-namespace-test.cs
@@ -2,4 +2,15 @@ using System;
 
 namespace ImenuTest
 {
+    public interface IMenuTestInterface
+    {
+    }
+
+    public class IMenuTestClass
+    {
+    }
+
+    public enum IMenuTestEnum
+    {
+    }
 }



reply via email to

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