On Fri, 11 Jul 2008 21:03:51 +0200, Micael m8847@abc.se wrote:
On Friday 11 July 2008 16.07.14 Nick Treleaven wrote:
On Fri, 11 Jul 2008 13:37:59 +0200 Micael <m8847@abc...> wrote:
As far as I can understand, there's no keyword autocompletion. With this I mean e.g. that I type "wh" and hit space, where the editor exanps the keyword and builds the construct, such as: while ( ) { } .. or similar.
I understand that the functionality is almost there, by instead use TAB, but only once the full keyword has been entered. i.e. while<TAB> builds the construct.
You can set the 'Complete snippet' keybinding to space if you like.
Actually, no, as Geany (yet) does not have context knowledge - i.e. if I would write the (quite common) word "if" whithin a comment, it would expand to the construct build...
Well, this can be considered as a bug or as a feature...IMO it's a feature because in this way it's also possible to use snippet completion in comments. And since snippet completion is intended to be triggered explicitly for instance by using TAB and not Space, I don't think this is a real problem.
I also realise that snippets could be enhanced to do this, if there would be an optional accept length? e.g: "accept keyword min len lookup = 2" would give the correct key-word expansion after at least wh and TAB where entered. (Obviously whi<TAB> would also work)
Maybe this could be implemented. For now you could edit ~/.geany/snippets.conf and change the 'while' key to 'wh'.
Yeah, I guess! Maybe that is a solution. As this will generate quite a few snippets, I would be concerned about the speed. But maybe this
As Frank told, try it. Anyway, the snippets are read from the file once at startup and then they are kept in a hash table which is a quite good data structure for this case. The code surely can be improved but I don't think speed is a real concern if you about up to 50 snippets. Check it out.
Regards, Enrico