Estetic changes

This commit is contained in:
Nikolajus 2012-02-09 09:42:50 +01:00
parent a2b5b12bd5
commit 17df27bcbd
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import json
s = sublime.load_settings("Pretty JSON.sublime-settings") s = sublime.load_settings("Pretty JSON.sublime-settings")
class PrettyjsonCommand(sublime_plugin.TextCommand): class PrettyjsonCommand(sublime_plugin.TextCommand):
""" Pretty Print JSON """ Pretty Print JSON
""" """
@ -14,7 +15,7 @@ class PrettyjsonCommand(sublime_plugin.TextCommand):
selection = sublime.Region(0, self.view.size()) selection = sublime.Region(0, self.view.size())
else: else:
selection = region selection = region
try: try:
obj = json.loads(self.view.substr(selection)) obj = json.loads(self.view.substr(selection))
self.view.replace(edit, selection, json.dumps(obj, indent=s.get("indent_size", 4), ensure_ascii=False, sort_keys=s.get("sort_keys", True))) self.view.replace(edit, selection, json.dumps(obj, indent=s.get("indent_size", 4), ensure_ascii=False, sort_keys=s.get("sort_keys", True)))