Snippet Functionality
Submitted by Friday, 6 October, 2006 - 06:54
on
After being much inspired by Sune Simonsen's wonderful SuperAbbrevs, i decided i would try my hand at coding my take on the "Snippets" concept which seems to have become so popular (and expensive... trendy... dangerous? ;-P ) recently in light of the public's adoration for textmate and all things supernaturally shiny.
https://webspace.utexas.edu/kem642/www/Snippets_SRC.zip
i'm posting the code here in hopes that if i completely run out of time it will at least be available for posterity, BUT MORE OPTIMISTICALLY on the chance that one of you might take a brief look at it and point out where i might be going wrong api-wise, or where i've taken the decidedly more difficult path. For one things, my use of BufferChangeListeners seems to have become deprecated. Updates... the devil take them!
i'll likely hack away as time (and school) permit. I'll keep you all posted here, assuming this is the proper place to do so... (?)
A few noets:
I am working for compatibility with the current development version (4.3pre6), and have funcitoning (read: not well tested, but it "works for me and my limited imagination" (TM) ) solution for recursive snippets (use them inside of each other!) with end tags via a stack of insertions per buffer. the framework is in place to at least parse templates with named variables (i.e. with the same value), default values, and enumerated field values, but those remain broken for the moment in terms of actual functionality. The method of selection is currently a triggered inline popup which does a running filter and auto-insertion of the last match. Defining new snippets based on input not recognized there is planned, but not currently implemented (the method is called, but it doesn't do anything yet).
currently, the snippets are stored like /%userdir%/.jedit/snippets/%mode%/%name of snippet%.snip
there is no snippet editor or viewer in place (options panel) in place quite yet, but that ought to be trivial to pull off (or at least more straightforward).
the archive includes a buildfile i use to build the jar file when i compile. if you've got ANT and a JDK you shouldn't have any problems if you want to give it a whirl.
it ain't clean, but with a little time, it will ready to go soon enough.
thanks in advance for any help, direction, etc.
dont worry... you'll get thanked again, too!
~K
https://webspace.utexas.edu/kem642/www/Snippets_SRC.zip
i'm posting the code here in hopes that if i completely run out of time it will at least be available for posterity, BUT MORE OPTIMISTICALLY on the chance that one of you might take a brief look at it and point out where i might be going wrong api-wise, or where i've taken the decidedly more difficult path. For one things, my use of BufferChangeListeners seems to have become deprecated. Updates... the devil take them!
i'll likely hack away as time (and school) permit. I'll keep you all posted here, assuming this is the proper place to do so... (?)
A few noets:
I am working for compatibility with the current development version (4.3pre6), and have funcitoning (read: not well tested, but it "works for me and my limited imagination" (TM) ) solution for recursive snippets (use them inside of each other!) with end tags via a stack of insertions per buffer. the framework is in place to at least parse templates with named variables (i.e. with the same value), default values, and enumerated field values, but those remain broken for the moment in terms of actual functionality. The method of selection is currently a triggered inline popup which does a running filter and auto-insertion of the last match. Defining new snippets based on input not recognized there is planned, but not currently implemented (the method is called, but it doesn't do anything yet).
currently, the snippets are stored like /%userdir%/.jedit/snippets/%mode%/%name of snippet%.snip
there is no snippet editor or viewer in place (options panel) in place quite yet, but that ought to be trivial to pull off (or at least more straightforward).
the archive includes a buildfile i use to build the jar file when i compile. if you've got ANT and a JDK you shouldn't have any problems if you want to give it a whirl.
it ain't clean, but with a little time, it will ready to go soon enough.
thanks in advance for any help, direction, etc.
dont worry... you'll get thanked again, too!
~K