Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a second column possible for variable defined values? #77

Open
R0dri opened this issue Jan 13, 2022 · 1 comment
Open

Adding a second column possible for variable defined values? #77

R0dri opened this issue Jan 13, 2022 · 1 comment

Comments

@R0dri
Copy link

R0dri commented Jan 13, 2022

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
Copy link
Author

R0dri commented Jan 13, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant