[TxMt Plugins] Version Control Plugins

Allan Odgaard throw-away-1 at macromates.com
Sat Oct 29 17:48:32 UTC 2005

On 28/10/2005, at 16.19, Chris Thomas wrote:

> Just some quick notes while I'm idly thinking about this.
> ...
> For maximum flexibility, probably most version control operations  
> should still be handled through the current bundle system. However,  
> there are two very desirable things we can't do with the bundles:
> (1) a context-sensitive version control menu (perhaps a "Version  
> Control" submenu for the context menu)
> (2) a graphical indication for each file of the current version  
> control state - another icon in the newly mousable status bar :) [...]

It requires a little more work from the plug-in, but how about  
something like:

    // callbacks/notifications the plug-in can subscribe to
    open file
    show/hide file (for tabs)
    save file (sending both will/did save)
    close file (maybe open/close should just be sent when switching  
tab to minimize the API)

I think these notifications would be useful for Gerts code browser  
plug-in as well, and could also be used to make save hooks.

Now, for the visualization of SCM I'd propose doing it “push” style,  
and e.g. have a (simple) API to add/remove a cell (NSCell) to/from  
the status bar. That way the plug-in can add a cell that displays svn  
status, but could also add something completely different, like a  
function drop down :), a toggle that enables/disables the save hook etc.

For the context menu, I'd suggest a callback like “will show context/ 
action menu for file”. This should again allow arbitrary actions to  
be added to the menu.

As for shell commands, I'd do one last method (added to the plug-in  
controller) which allows executing a bundle item (given by UUID) in  
the context of (a) file. So a SCM system could populate the context  
menu with actions that actually just wraps for the bundle items (it  
would be logical to add a PlugIns folder to the bundles, and allow  
the user to enable/disable plug-ins per bundle in the BE, but e.g.  
for svn, it would be enabled but just stay passive for files not  
under svn control).

More information about the textmate-plugins mailing list