imenu-list icon indicating copy to clipboard operation
imenu-list copied to clipboard

Adding a second column possible for variable defined values?

Open R0dri opened this issue 3 years ago • 1 comments

hello, I don't know if this request belongs here or this is beyond the scope of what this mode is capable of

I'm currently writing a generic expression for C# so imenu can recognize namespaces, classes, functions and variables. image I was thinking that it could be awesome to add an extra column to display the value of the variable if it is defined like so: image and if we are feeling happy about columns maybe even go further like: image

This can all be done without changing too much the definitions i.e. ("Variables" "\\(\\sw+\\) = \\(\\sw+\\)" 1 2) where you can define what goes on what column by group number.

R0dri avatar Jan 13 '22 23:01 R0dri

Btw, here is my current code if anyone needs it*:

  (setq csharp-imenu-functions
        '(
          ("Variables" "^\\s-*[a-zA-Z0-9._ ]* \\([a-zA-Z0-9_]*\\)\\( = \\sw*\\|\\s-*\\);$" 1 2)
          ("Functions" "^\\s-*[^/]* \\([a-zA-Z0-9_]+\\)(.*)\\(\\s-*.*\n\\|\\ *\\)\\s-*{" 1)
          ("Classes" "^\\s-*\\(.*\\)class +\\([a-zA-Z0-9_]+\\)" 2)
          ("Namespaces" "^namespace +\\([a-z0-9_]*\\)" 1)
          )
        )

  (add-hook 'csharp-mode-hook
            (lambda()
              (setq imenu-generic-expression csharp-imenu-functions)
              )
            )

*currently it detects "using" imports as variables. I haven't done much work with it yet so there may be some more exceptions I don't know. I'll try to keep this updated.

R0dri avatar Jan 13 '22 23:01 R0dri