eerohele / exalt

A Sublime Text plugin for validating and formatting XML documents
MIT License
22 stars 3 forks source link

[Bug] exalt_format_selections delete lines. #5

Closed Kristinita closed 7 years ago

Kristinita commented 7 years ago

1. Summary

exalt_format_selections delete lines.

2. Expected behavior

Format selected code.

3. Actual behavior

Some lines of code was deleted.

4. Steps to reproduce

The problem is reproduced for me in a version of Sublime Text without plugins and user settings.

I select lines in my xml-document. Ctrl+Shift+PExalt: Format Selections → last 9 lines delete for me.

5. Environment

Operating system and version: Windows 10 Enterprise LTSB 64-bit EN Sublime Text: Build 3126

Thanks.

eerohele commented 7 years ago

The README isn't clear about this, but Exalt can only format well-formed XML fragments. If you select two XML elements as indicated in your link, your XML fragment won't have a root element, which means it isn't well-formed.

By default, Exalt tries to recover non-well-formed XML when formatting, which is probably why it deletes the lines.

Probably the best way to work around this restriction is to use Sublime Text's multiple cursors feature and select the two <dict/> elements separately and then use Exalt's "Format Selections" command to format them.

Does that work for you?

Kristinita commented 7 years ago

Does that work for you?

Yes, it worked for me. Please, add information about exalt_format_selections to README.MD.

Thanks.

eerohele commented 7 years ago

Looks like I actually already had a note about that in the README.