[TxMt] Re: Bundles. How to: enable IDE style autocomplete ( function name + parameter snippets )

Aldo Bucchi aldo.bucchi at gmail.com
Fri Sep 10 17:56:12 UTC 2010


Hi Allan,

On Tue, Aug 31, 2010 at 12:48 PM, Allan Odgaard
<mailinglist at textmate.org> wrote:
> On 31 Aug 2010, at 16:33, Aldo Bucchi wrote:
>
>> [...]
>> Sorry. I meant writing code. I just joined this list and I now realize
>> there is a wide spectrum regarding coding skills. I can code ;)
>
> Great :)
>
> In that case, the main ingrediant is the dialog plug-in.
>
> If you open a new TextMate document and press ⌃R on the following line:
>
>    "$DIALOG" help
>
> It will show the available options for “showing dialogs” (⌃R runs the
> current line as a shell command).
>
> More specifically you want to use the popup command ("$DIALOG" help popup).
>
> I think the initial version of the Objectice-C completion was a simply
> command¹ which did something like:
>
>    #!/usr/bin/env ruby
>    list = `grep "^$TM_CURRENT_WORD"
> "$TM_BUNDLE_SUPPORT/completions.tsf"`.split("\t")
>
> Then used "$DIALOG" to show the matches (and insert the chosen one as a
> snippet).

Works great ;)

Now, I am trying to push the envelope a bit.

I would love to provide a very verbose "display" text ( which includes
not only the name of the item but also a description ).

So, today:

my_fun...
shows popup menu with two items:
** my_function
** my_funnel
selecting "my_function" inserts "my_function" and then triggers an
"insert snippet"

Tomorrow:

my_fun...
shows popup menu with two items:
** my_function( string a, string b ). some explanation
** my_funnel( string a ). some explanation
selecting "my_function( string a, string b ). some explanation"
inserts "my_function" and then triggers an "insert snippet"

I tried to achieve this, but the main issue is that Dialog.popup()
inserts the "display" text by default. So I end up with:

"my_function( string a, string b ). some explanation. ( string, string b)"

where the second part is the snippet.

Having coded Eclipse and IDEA plugins, I'm impressed with the
flexibility of the system.
Of course I miss having a full blown parse tree to work with but... it
feels like I can go 80% of the way with 20% of the effort.

Regards,
A

>
>
> ¹ http://manual.macromates.com/en/commands
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
>



-- 
Aldo Bucchi
@aldonline
skype:aldo.bucchi
http://aldobucchi.com/



More information about the textmate mailing list