[Geany-devel] SF.net SVN: geany: trunk
lists.ban at xxxxx
Thu Apr 14 18:37:01 UTC 2011
Le 14/04/2011 19:15, Frank Lanitz a écrit :
> On Wed, 13 Apr 2011 21:55:31 +0000
> colombanw at users.sourceforge.net wrote:
>> Revision: 5724
>> Author: colombanw
>> Date: 2011-04-13 21:55:31 +0000 (Wed, 13 Apr 2011)
>> Log Message:
>> Avoid triggering autocompletion on PHP open tags (closes #3199442)
> I'm not sure whether this is really useful as this is adding (not much)
> complexity and more check on typing time, but not increasing typing
> comfort much IMHO.
I saw you responded to the bug report and said wontfix, but I personally
agree with the reporters of #3199442 that when writing PHP code it's
common to type "<?php\n", and when you have the minimum completion
length set to 3 or less it's annoying to have the completion coming up.
Generally I don't even notice the completion came up and get the first
item where I wanted nothing, forcing me to remove it/undo.
So I think it's a useful thing for PHP writers, worth having a special
case for it. And I think Geany is widely used for PHP code editing, so I
think (again) that it'd help many users, not only a few ones.
Moreover, I don't think the check I added is likely to have a real
overhead on typing, especially with non-PHP code. I tried to built the
condition correctly for it not to match as soon as possible (e.g. the
less likely stuff first) but you might want to optimize it even further
(maybe at the cost of a little readability) by e.g.
*) use G_UNLIKELY()
*) reorder the check even better, though I think it's less readable:
ft->id == GEANY_FILETYPES_PHP &&
rootlen == 3 &&
startword >= 2 &&
style == SCE_HPHP_DEFAULT &&
strcmp(&root[-2], "<?php") == 0
However, I agree that this adds a little complexity in the code, but
AFAIK we don't have (currently?) any other solution to support this --
and I don't think it's really useful to have a generic solution, since
there's not so many special cases like this.
That's my opinion, but feel free to convince me it's wrong (e.g.
measurements of the speed cost showing it's a significant overhead, or
whatever) -- or even that it's just "bad, that's all" and I must go with
it  :D
 given that I don't write PHP often anymore, I'd personally even not
be really annoyed ^^
More information about the Devel