SublimeOutline icon indicating copy to clipboard operation
SublimeOutline copied to clipboard

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

Open maegul opened this issue 3 years ago • 4 comments

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?

maegul avatar Jan 28 '22 01:01 maegul

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

warmdev avatar Feb 02 '22 15:02 warmdev

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!

maegul avatar Feb 03 '22 01:02 maegul

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!

mattjbloch avatar Mar 16 '22 21:03 mattjbloch

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

Monox18 avatar Jun 17 '23 00:06 Monox18