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.
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?
(I haven't really looked at editor_insert_snippet yet.)
I'm not sure about having snippet names enclosed in <> angle brackets in snippets.conf, maybe.
- &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.
- &utils_find_open_xml_tag
Ok.
Nick