[TxMt] Re: TM2 - possible ESC completion bug for Obj-C++ syntax

Allan Odgaard mailinglist at textmate.org
Sat Jan 21 03:01:08 UTC 2012

On 19/01/2012, at 17.10, Hans-Jörg Bibiko wrote:

> 1)
> To reproduce
> - open a new window, set language to Obj-C++
> - press ESC ⇢ nothing happens - fine
> - press ⇥, and then ESC ⇢ "retain" will be inserted whereby I didn't type any character

Since there is no prefix/suffix it inserts first completion candidate which is taken from the scoped settings (which provide a list for Objective-C wherein retain is included).

> furthermore
> 2)
> - if I select something in a Obj-C++ doc and press ESC the selection will be replaced by retain
> I have no idea if this is a feature or a bug but I would argue that this is a bit weird since it could happen that one presses ESC more or less accidentally.
> At least a selection should be untouched and ESC-completion should only be invoked if there's at least one character left from cursor as it is in TM1.

Esc-completion changed to allow empty prefix (since it also looks at suffix now).

I can make it a no-op when both prefix and suffix is empty to help users who accidentally press keys and expect nothing to happen — the argument seems a bit weird though ;) but given that the result from pressing ESC is likely unpredictable, I won’t claim it is a useful feature to always get a completion candidate inserted, although it could perhaps be if say, a custom completion command is setup say, for my unit test files or at root level in @implementation … @end to insert boilerplate for the only unit that makes sense given the context (i.e. method for the latter, unit test body for the former).

More information about the textmate mailing list