Hi,
On Wed, 13 Apr 2011 21:55:31 +0000 colombanw@users.sourceforge.net wrote:
Revision: 5724 http://geany.svn.sourceforge.net/geany/?rev=5724&view=rev 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.
Cheers, Frank
Le 14/04/2011 19:15, Frank Lanitz a écrit :
Hi,
Hi Frank,
On Wed, 13 Apr 2011 21:55:31 +0000 colombanw@users.sourceforge.net wrote:
Revision: 5724 http://geany.svn.sourceforge.net/geany/?rev=5724&view=rev 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 [1] :D
Cheers, Colomban
[1] given that I don't write PHP often anymore, I'd personally even not be really annoyed ^^
On Thu, 14 Apr 2011 20:37:01 +0200 Colomban Wendling lists.ban@herbesfolles.org wrote:
Le 14/04/2011 19:15, Frank Lanitz a écrit :
Hi,
Hi Frank,
On Wed, 13 Apr 2011 21:55:31 +0000 colombanw@users.sourceforge.net wrote:
Revision: 5724 http://geany.svn.sourceforge.net/geany/?rev=5724&view=rev 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 [1] :D
Well, its hard to say, but maybe you are right. At least your points do sound reasonable. ;)
Cheers, Frank
Well, its hard to say, but maybe you are right. At least your points do sound reasonable. ;)
Cheers, Frank
I can completely understand the problem, I have a similar MAJOR annoyance with Python, anything on the end of the line that is a prefix of a completion gets the first completion chosen when return is typed to end the line. This doesn't happen in C or C++ since rarely do lines end in a word, they mostly end in punctuation.
But for other languages the choice of return to select the item from the completion list is inappropriate. I have been forced to turn autocompletion off for Python, but that means remembering it since there is only one preference, not a per language one.
The proper solution would be to stop return selecting the item from the menu, but unfortunately there does not seem to be any way of changing that since it is the default activate keycode defined somewhere deep in GTK.
The only implementation I can think of is to make the entire menu inactive so return does not activate it and the key defined by prefs (default tab) does the job.
So I don't think a PHP specific solution is appropriate, we do need to look for a general solution.
Cheers Lex
-- Frank Lanitz frank@frank.uvena.de
Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Am 17.04.2011 13:13, schrieb Lex Trotman:
I can completely understand the problem, I have a similar MAJOR annoyance with Python, anything on the end of the line that is a prefix of a completion gets the first completion chosen when return is typed to end the line. This doesn't happen in C or C++ since rarely do lines end in a word, they mostly end in punctuation.
But for other languages the choice of return to select the item from the completion list is inappropriate. I have been forced to turn autocompletion off for Python, but that means remembering it since there is only one preference, not a per language one.
I seem to remember it was possible to close the autocompletion list with escape at some time which solved that for me sufficiently, but I remapped escape ages ago. Now I tried it again it is not possible anymore, the "cancel autocompletion" keybinding actually inserts the selected item.
Best regards.
I seem to remember it was possible to close the autocompletion list with escape at some time which solved that for me sufficiently, but I remapped escape ages ago. Now I tried it again it is not possible anymore, the "cancel autocompletion" keybinding actually inserts the selected item.
Yes, "escape closes menu/dialog" is another GTK built in.
But it doesn't really work for me, by the time I've noticed that the autocompletion has been displayed and started to re-program the muscles to press escape (way over the other side of the keyboard from return) I've already pressed return , .... !@#$%^&*()
Cheers Lex
Best regards. _______________________________________________ Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel