[TxMt] Re: TextMate Code Completion
Chris Thomas
chris at cjack.com
Thu Dec 7 18:17:55 UTC 2006
On Dec 7, 2006, at 9:37 AM, thomas Aylott wrote:
> We could use a custom nib inside of tm_dialog instead of the --menu
> I think we could even use Allan's borderless panel subclass.
> Then it would look a lot more like the normal code completion thing
> that every other cocoa app uses.
> There have been a bunch of changes to tm_dialog lately,
(If by 'lately' you mean r6308. :)
> anyone know how doable this is?
Should be doable -- though maybe not quite as nice as the standard UI,
because there's (currently) no way to autoresize the window to conform
to the text size. Create a nib with an NSPanel; set the Custom
Subclass of the window to the borderless subclass already present in
TM. Add an NSTextView (graphics/fonts disabled) for the completion
text and an NSTableView for the suggested completions; for the
NSTextField value binding, set the 'Continously updates value' check
box. The main loop would look something like:
dialog.wait_for_input do | input |
user_text = input['completionText']
suggestions = completions_for(user_text)
# Subword completion
if user_text.end_with?(TabKeyChar) then
user_text = common_prefix_of_strings(suggestions) || user_text.sub(/
#{TabKeyChar}$/, '')
end
dialog.parameters = {'completionText' => user_text;
'suggestedCompletions' => suggestions}
end
Chris
More information about the textmate
mailing list