federomero / pretty-json

Atom plugin. Format JSON documents.
MIT License
94 stars 23 forks source link

Selected text following reformat should fit replaced text. #42

Closed lexicalunit closed 8 years ago

lexicalunit commented 8 years ago

Open a new file and enter the text:

{"foo": 1,
"bar": 2}

Then select everything and run the prettify command on it. Afterwards, the text:

{
    "foo"

is what will be selected. Instead all the JSON data that was previously selected should still be selected. In other words, formatting selected data should not change what data is selected.

lexicalunit commented 8 years ago

@ryan-durkin I've updated the code to properly select the range of the newly inserted text following prettification/minification/jsonificiation. Cheers!