Re: [anjuta-devel] How do snippets work?



Hi Philip!

Hmm, to be honest, I don't know exactly.

Theoretically it would be easy to add a "selection" internal snippet to
the snippets-manager to be able to use the current selection. Internal
variables can only be defined in code though and this still has the
problem that you would alter the selection when you try to insert the
snippet. Adding text-editing magic to the snippets manager seems to be
very difficult though.

Regards,
Johannes

Am Sonntag, den 15.01.2012, 21:11 +0100 schrieb Philip Chimento:
Hi there,

I never tried the snippets manager before but I'd like to learn how to
use it. There doesn't seem to be any info in the manual currently -
perhaps, having helped with the manual before, I could write about it?

First, though, I have to figure out how to use it, and the purpose of
this mail is to ask for help with that ;-)

My itch to scratch was to try to add a snippet that puts a GObject
cast around the currently selected text in the editor. So, I select a
variable "foo" in the code by double-clicking on it, press the hotkey
for the snippet, and that should change to GTK_|(foo) where |
represents the position of the insertion point, so that I could go on
to type WINDOW or whatever.

I got as far as GTK_${END_CURSOR_POSITION}(). I also understand that
you can't do something to the currently selected text, because you
need to type to insert a snippet, which would overwrite the selected
text... perhaps I could make the snippet put its parentheses around
the next word in the editor? I understand that I have to add an Anjuta
snippet variable, but I can't find where to connect that to the
internals of Anjuta or how.

Thanks in advance for your help,

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]