On Thu, 11 Nov 2010 17:42:49 +0000% Nick Treleaven nick.treleaven@btinternet.com wrote:
On Mon, 8 Nov 2010 12:55:23 +0300 Eugene Arshinov earshinov@gmail.com wrote:
On Fri, 22 Oct 2010 13:38:42 +0100% Nick Treleaven nick.treleaven@btinternet.com wrote:
On Fri, 22 Oct 2010 12:51:10 +0400 Eugene Arshinov earshinov@gmail.com wrote:
The suggestion is to make use of snippets: if "table" or "<table>" snippet is specified in [HTML] section of snippets.conf, the snippet is automatically inserted, otherwise <table> tag is just closed, like other tags now. This should also work for any other tag.
Though, you can just define a snippet (say, "table") and use it when you want to insert a table. I doubt it's worth implementing the suggestion if everything it gives is the ability to type "<table>" instead of typing "table" and pressing complete-snippet keybinding.
Perhaps the behaviour could be moved to the 'HTML chars' plugin, which could be renamed HTML or Markup.
Geany will have to notify the plugin about every char added. Won't it be too "heavy" to send a signal in this case?
Actually, this is already done for that plugin. See the editor-notify signal.
Hi.
Extracting this into a plugin was a good idea. I decided to add a new one instead of extending HTML Chars because their functions are pretty different (though both related to XML and HTML). If I extended HTML Chars, I would need to add a checkbox to separately turn the completion-based-on-snippets on/off. In a separate plugin user achieve the same result by enabling/disabling the whole plugin, which is simpler and more obvious.
I called the new plugin "XML snippets". It's not pretty obvious, but I couldn't think of anything better and short enough. If you have an idea, feel free to rename it.
I'm not sure that it should be distributed with Geany, I think the 'table' snippet is enough to replace auto-table. The plugin could be added to geany-plugins though.
OK, I'll port it.
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?
(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.
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".
- &sci_is_string_style,
- &sci_is_comment_style,
- &sci_is_code_style
I think these would fit better in highlighting.c, but could then be part of the API. They're not really related to Scintilla messages, and it would group lexer information in the same file.
OK, I will move them.
- &utils_find_open_xml_tag
Ok.
Nick _______________________________________________ Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany