[Geany] The plugin - Re: Use snippets for HTML autocompletion?
Eugene Arshinov
earshinov at xxxxx
Thu Nov 11 18:46:51 UTC 2010
On Thu, 11 Nov 2010 18:33:14 +0000%
Nick Treleaven <nick.treleaven at btinternet.com> wrote:
> On Thu, 11 Nov 2010 21:09:32 +0300
> Eugene Arshinov <earshinov at gmail.com> wrote:
>
> > > About the API changes:
> > > > + &editor_get_snippets_for_file_type,
> > > > + &editor_insert_snippet
> > >
> > > I'm not sure these are necessary, particularly
> > > editor_get_snippets_for_file_type - I don't want to expose the
> > > snippet data structures unnecessarily. Perhaps
> > > editor_find_snippet(doc, snippet_name) instead?
> > >
> >
> > The reason why I decided to export a hash table is that it allows a
> > plugin to decide independently whether to account "default"
> > snippets or just use the ones specified directly for the filetype
> > (I must note that there is currently no separate function to get
> > the default snippets, and relying on the fact that one can get it
> > by passing "default" as filetype name is really bad). If we
> > provide a function like editor_find_snippet, we need to fix the
> > behaviour in it or add a boolean argument. Now I think, the latter
> > is the best choice. Your opinion?
>
> Do plugins need to look up a default snippet?
Currently no. And when such a plugin appears, we can always extend the
API. It seems to be another reason to keep it simple and use
editor_find_snippet(doc, snippet_name).
>
> Anyway perhaps editor_find_snippet(snippet_name, ft) is more flexible.
> Perhaps passing NULL for ft could lookup a default snippet, if that's
> necessary.
>
Yes, I think it's a good alternative to additional function argument.
> > > (I haven't really looked at editor_insert_snippet yet.)
> > >
> >
> > Basically there was some code common for snippet insertion and
> > (recently introduced) snippet keybindings. As I needed similar
> > functionality in the plugin, I extracted it to a separate function
> > and exported.
>
> Ok.
>
> > > I'm not sure about having snippet names enclosed in <> angle
> > > brackets in snippets.conf, maybe.
> > >
> >
> > I explained it a bit in the documentation (geany.txt): "It allows
> > you to define snippets, which need not to be automatically
> > inserted, without any name clashes".
>
> Ok, but I'm not keen on distributing <tag> snippets with Geany, it
> just seems ugly having some 'tag' snippets, some '<tag>'. I see the
> reason though.
>
Ah, again I missed something. If in the plugin I use 'tag', the plugin
will automatically support 'table' snippet included in Geany since
recently. I think it's more important than preventing name clashes, so
it's probable worth changing to 'tag'.
Best regards,
Eugene.
More information about the Users
mailing list