warmdev / SublimeOutline

Outline view for Sublime Text 3
MIT License
66 stars 23 forks source link

Add ability for a custom callback function to define the symbols? #35

Open maegul opened 2 years ago

maegul commented 2 years ago

Would it be possible to provide a function that generates arbitrary "symbols" to this plugin so that it is not entirely reliant on the symbols list mechanism?

My reason is that the package Comment Marks searches for user generated "symbols" which are just comments containing a special character (eg # >). It would be cool if one could easily plug such a plugin into this Ouline plugin without too much fuss.

Perhaps any function that returns a list of Sublime.SymbolRegion objects would suffice?

How a callback would be provided I'm not entirely sure. Thoughts?

warmdev commented 2 years ago

This is technically possible, but I am also not sure how a callback function would be implemented.

maegul commented 2 years ago

I'm not an experienced Sublime plugin author ... so I'm sure there's plenty of experience/wisdom either of us could seek (when we've got time of course)! Thanks for responding.

My first thought off the top of my head is refactoring out any call to getsymbols() (I forget what the API interface to that is, but you get what I mean) to call a separate symbols command, which then potentially opens up flexibility through settings and key bindings, which could specify how the symbols command works. Pivotally, a setting could specify the name of another command (from any plugin), which could then be picked up by this symbols command which will function mostly as a proxy.

Don't know if that's really worth doing or what problems it poses. I'm sure other plugins have worked out decent systems for plugin interoperation.

Thanks for your response!

mattjbloch commented 2 years ago

Replying to say I agree, this would be fantastic. I currently use Table of Comments to add a table of comments / guide to longer programs, but one I have to bring up via a command every time I want to see it or move through it. It would be fantastic to be able to just always have it open on the side in an Outline window!

Monox18 commented 1 year ago

I'm not quite sure what you want to do with the "custom callback function"...

But let's see if I get it right, you want the ability to have comments displayed in the Outline, so that you can navigate them by clicking on them? as in this example. comment navigation