Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beautify only selected area results in entire file beautification when "Beautify Entire File On Save" enabled #103

Closed
dontdieych opened this issue Sep 23, 2014 · 12 comments
Assignees

Comments

@dontdieych
Copy link

POST /ctl/ContentDir HTTP/1.1
Host: 192.168.219.2:8200
SOAPAction: "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"
Accept-Language: en-us;q=1, en;q=0.5
Accept-Encoding: gzip
Content-Type: text/xml; charset="utf-8"
User-Agent: gupnp-av-cp GUPnP/0.20.12 DLNADOC/1.50
Connection: Keep-Alive
Content-Length: 445

<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1"><ObjectID>2</ObjectID><BrowseFlag>BrowseDirectChildren</BrowseFlag><Filter>@childCount</Filter><StartingIndex>0</StartingIndex><RequestedCount>64</RequestedCount><SortCriteria></SortCriteria></u:Browse></s:Body></s:Envelope>

HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
Connection: close
Content-Length: 1334
Server: 3.16.1-1-ARCH DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.1.4
Content-Language: en
Date: Sat, 20 Sep 2014 12:19:02 GMT
EXT:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:BrowseResponse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1"><Result>&lt;DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"&gt;
&lt;container id="2$8" parentID="2" restricted="1" childCount="78"&gt;&lt;dc:title&gt;All Video&lt;/dc:title&gt;&lt;upnp:class&gt;object.container.storageFolder&lt;/upnp:class&gt;&lt;upnp:storageUsed&gt;-1&lt;/upnp:storageUsed&gt;&lt;/container&gt;&lt;container id="2$15" parentID="2" restricted="1" childCount="1"&gt;&lt;dc:title&gt;Folders&lt;/dc:title&gt;&lt;upnp:class&gt;object.container.storageFolder&lt;/upnp:class&gt;&lt;upnp:storageUsed&gt;-1&lt;/upnp:storageUsed&gt;&lt;/container&gt;&lt;container id="2$FF0" parentID="2" restricted="1" childCount="50"&gt;&lt;dc:title&gt;Recently Added&lt;/dc:title&gt;&lt;upnp:class&gt;object.container.storageFolder&lt;/upnp:class&gt;&lt;upnp:storageUsed&gt;-1&lt;/upnp:storageUsed&gt;&lt;/container&gt;&lt;/DIDL-Lite&gt;</Result>
<NumberReturned>3</NumberReturned>
<TotalMatches>3</TotalMatches>
<UpdateID>186</UpdateID></u:BrowseResponse></s:Body></s:Envelope>

It is packet capture from wireshark. If I set this file type as xml then select only xml part then beautify, http header parts are also bautified(became big one line).

Workaround is comment out that header then beautify(selection or whole file).

Is that poissible "beautify this selection as xml whatever current file is"?

@Glavin001 Glavin001 added the bug label Sep 23, 2014
@Glavin001 Glavin001 self-assigned this Sep 23, 2014
@Glavin001
Copy link
Owner

Beautifying a selection should work as you described. What version of Atom Beautify are you running currently?

@dontdieych
Copy link
Author

% apm show atom-beautify
atom-beautify
├── 0.12.0
├── https://github.com/Glavin001/atom-beautify
├── Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, and SQL in Atom
├── 16066 downloads
└── 96 stars

Run `apm install atom-beautify` to install this package.

% atom --version       
0.130.0-5cc62b2
%

Here is more short sample file for reproduce.

HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
Connection: close
Content-Length: 2189
Server: 3.16.1-1-ARCH DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.1.4
Content-Language: en
Date: Sat, 20 Sep 2014 12:19:00 GMT
EXT:

<?xml version="1.0" ?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  </root>

Save file as "asdf.xml" then select xml part, beautify it.

@Glavin001
Copy link
Owner

Beautification works for me:

Before

HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
Connection: close
Content-Length: 2189
Server: 3.16.1-1-ARCH DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.1.4
Content-Language: en
Date: Sat, 20 Sep 2014 12:19:00 GMT
EXT:

<?xml version="1.0" ?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  </root>

After

HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
Connection: close
Content-Length: 2189
Server: 3.16.1-1-ARCH DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.1.4
Content-Language: en
Date: Sat, 20 Sep 2014 12:19:00 GMT
EXT:

<?xml version="1.0" ?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
</root>

Have you made any progress/work-around on this? Is this problem still occurring for you?

@Glavin001 Glavin001 changed the title Beautify only selected area Beautify only selected area results in entire file beautification Oct 17, 2014
@dontdieych
Copy link
Author

Yes, still. Both whole file or selected region.

  • Before - /tmp/asdf.xml

    HTTP/1.1 200 OK
    Content-Type: text/xml; charset="utf-8"
    Connection: close
    Content-Length: 2189
    Server: 3.16.1-1-ARCH DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.1.4
    Content-Language: en
    Date: Sat, 20 Sep 2014 12:19:00 GMT
    EXT:
    
    <?xml version="1.0" ?>
    <root xmlns="urn:schemas-upnp-org:device-1-0">
    <specVersion>
      <major>1</major>
      <minor>0</minor>
    </specVersion>
    </root>
    
  • After - /tmp/asdf.xml

    HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Connection: close Content-Length: 2189 Server: 3.16.1-1-ARCH DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.1.4 Content-Language: en Date: Sat, 20 Sep 2014 12:19:00 GMT EXT:
    
    <?xml version="1.0" ?>
    <root xmlns="urn:schemas-upnp-org:device-1-0">
    <specVersion>
      <major>1</major>
      <minor>0</minor>
    </specVersion>
    </root>
    
atom-0.135
atom-beautify-0.14.0

@anandthakker
Copy link

I'm experiencing similar issue with atom 0.139 and atom-beautify 0.14.1.

@anandthakker
Copy link

@dontdieych @Glavin001 Ah: unchecking 'Beatify entire file on save' in settings fixes this for me.

@dontdieych
Copy link
Author

@anandthakker confirmed on atom 0.139 and atom-beautify 0.14.1.
Thanks.

@Glavin001
Copy link
Owner

To confirm, this is a bug that Beautify entire file on save still applies when triggering beautification manually with beautify command, and not on-save event?

@anandthakker
Copy link

@Glavin001 Yep!

@Glavin001
Copy link
Owner

Thanks, @anandthakker.

I can reproduce this error when I enable Beatify entire file on save. Will look into this now. Thanks for feedback everyone!

@Glavin001 Glavin001 changed the title Beautify only selected area results in entire file beautification Beautify only selected area results in entire file beautification when "Beautify Entire File On Save" enabled Oct 26, 2014
@Glavin001
Copy link
Owner

Published to v0.15.1. Thank you everyone for your feedback and patients!

@dontdieych
Copy link
Author

Beautify works well only selected area no matter what "Beautify Entire File On Save" option.

% atom --version
0.139.0-df439f5
% apm show atom-beautify                                                                           :(
atom-beautify
├── 0.15.1

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants