[Geany] Keyword auto completion?

Enrico Tröger enrico.troeger at xxxxx
Sat Jul 12 09:53:21 UTC 2008


On Fri, 11 Jul 2008 21:03:51 +0200, Micael <m8847 at 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 at 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

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20080712/9bb7b696/attachment.pgp>


More information about the Users mailing list