Try to format whole document if no selection

99% of times I need to format JSON I'm looking at an uglified JSON file. It would be very convenient if I could just use the "Format JSON" command WITHOUT having to select the text of the whole document first. If there's not only JSON in the document I could still select it before calling the command.

This change checks whether there is a selection, if yes, applies the command to the selection, if not tries to format the whole document.