One thing that my users currently have to do after each start-tag completion is to add end-tags manually by typing "<\" after which a proper end tag is added. This is problematic for two reasons: first, the user has to do stuff which the editor should do for her, and second, the caret is always moved to the end of each completion. This then requires a manual move of the caret to the in-between-tags space, so that a value or more children may be added to an XML element (the most common editing command when writing XML).
This is incredibly annoying. So I thought: "Okay. Let's simply provide a completion with both start and end tags (when possible) and then move the caret between them.", but this seems to be easier said than done. Is there a way to somehow move the caret after a successful completion has been done - and only for certain completions?
Details of what I wish to do (where | is the caret):
- Code: Select all
1. Editor state: "<con|"
3. [select <ns1:config xmlns:ns1='http://example.com/ns/config/1.0'"></ns1:config>]
Editor state: "<ns1:config xmlns:ns1='http://example.com/ns/config/1.0'>|</ns1:config>"
Also is there a way for "implicit" auto-completions to be provided? For example if the editor is in the final state which I described above and Enter is pressed at that caret position and implicit auto-complete would be issued which would add a newline and a single tab between the tags (instead of a single newline). I could probably do that by listening for key events myself though.