Contentless tags are not displayed correctly by autocomplete

SyntaxEditor Web Languages Add-on for Windows Forms Forum

Posted 17 years ago by Jason Sobell
Version: 4.0.0257
Platform: .NET 2.0
Environment: Windows XP (32-bit)
Avatar
If a schema Element specifies 'mixed="false"' then it can't contain text, so should be rendered as an empty tag.
The auto-complete function currently auto-enters a closing tag and leaves the cursor in the middle, which is valid from a schema point of view but makes a mess of things like <br/> in XHTML.
Could the system do an auto-correct as follows:
<
<b
<br
<br>
<br/>
i.e. When the closing tag is found and the element doesn't allow content, then just close the tag correctly?
Perhaps this could be a property, or for maximum flexibility you could allow a dictionary of tags names to be handled this way?

Cheers,
Jason

Comments (6)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I'm not sure if we'll do that exactly but this does bring up a good point, and we've made some enhancements for the next maintenance release to make it work just like Visual Studio:

Updated the element member list so that if the element cannot contain any content, a /> is automatically inserted after the caret when the member list item is selected.

This means as you type (| is caret):
<|
[Member list opens]
<b|
<br|
[Press Tab to select br tag]
<br|/>

It works very nicely.


Actipro Software Support

Posted 17 years ago by Jason Sobell
Avatar
OK, that sounds good. The only reason I suggested the suffix replacement is because when your empty tags contains attributes (as in the situation I'm working on) it makes sense to keep typing, then simply close the tag with '>', rather than have attributes being inserted then have to cursor out afterwards, but your solution should be fine :)

Cheers,
Jason
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
How about instead of this, we would have the / key auto insert the > and move the caret after it? I can't think of another scenario where you wouldn't put a > right after the / when within a tag and not in an attribute value, can you?


Actipro Software Support

Posted 17 years ago by Jason Sobell
Avatar
I don't think this would help much, as the issue is that most users don't realise they need to enter a '/' at that point, so an auto replacement of ">" with "/>" implies "it's no good just closing the opening tag, you need to terminate the pair too".

Cheers,
Jason
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
After testing a little more, I switched it around to be more like you requested and it's working pretty well. So if you do a member list and press tab to insert "br" then you can press ">" and it auto inserts the "/" and moves the caret after the ">". It makes for very fluid typing.


Actipro Software Support

Posted 17 years ago by Jason Sobell
Avatar
Sounds ideal. Thanks :)

Cheers,
Jason
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.