imenu-list
imenu-list copied to clipboard
Adding a second column possible for variable defined values?
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.
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:
and if we are feeling happy about columns maybe even go further like:
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.
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.