[TxMt] Poll. generic code completion plug-in
Joachim Mårtensson
joachimm at etek.chalmers.se
Fri Aug 17 17:00:28 UTC 2007
Hello, everyone.
I have written a more Xcode like completion extension for tm_dialog. My
guess is that this is of interrest to more people than me. The code has
not been commited yet, but I have made a screencast to show of some of the
functionallity.
[ http://mail.mac.se/joachimm/TextMateCodeCompletionEnhancements.mov ]
, right now I am looking for suggestions for the programmatic and user
interface.
what I have so far
"$DIALOG" -f -p '{suggestions = ({title = "foo";filterOn = "foo";},{title
= "bar";filterOn = "bar";snippet = "(${1:hello}, ${2:again})";});
mutablePrefix = "fo"; staticPrefix = "";}
as you can see you need to populate an array called 'suggestions' with
dicts with the keys 'title' and 'filterOn', the key 'snippet' is optional.
you also have to give the keys mutablePrefix which is the prefix when you
launched the command. plus the optional staticPrefix which is handy when
you are completing things that are multipart such as objective-c methods
(it is not really necessary since filterOn does not have to have the same
prefix as title).
Once the command is running it should work as follows.
* an alphanumeric key press appends to mutablePrefix, there by potentially
limiting the list of candidates.
* a tab press inserts the longest common prefix among the candidates, this
will ofcourse never limit the list in itself, but can quickly be followed
up with a alphanumeric keypress, thereby saving lots of typing.
* a return inserts the current selection in the list, plus its snippet key
if there is one.
* delete removes a char, if this moves the caret before the beginning of
the search prefix the dialog goes away
* up/down moves in the list
* any other key closes the dialog and hands control back to TextMate.
What are your thought, am I missing something that could be useful for
your language?
Thanks in advance.
Joachim Mårtensson
More information about the textmate
mailing list