Issue #22 change syntax only if json object was prettified
This commit is contained in:
parent
5bf0c1f16d
commit
fd69613832
|
@ -20,10 +20,13 @@ class PrettyjsonCommand(sublime_plugin.TextCommand):
|
||||||
"""
|
"""
|
||||||
def run(self, edit):
|
def run(self, edit):
|
||||||
for region in self.view.sel():
|
for region in self.view.sel():
|
||||||
|
|
||||||
|
selected_entire_file = False
|
||||||
|
|
||||||
# If no selection, use the entire file as the selection
|
# If no selection, use the entire file as the selection
|
||||||
if region.empty() and s.get("use_entire_file_if_no_selection", True):
|
if region.empty() and s.get("use_entire_file_if_no_selection", True):
|
||||||
selection = sublime.Region(0, self.view.size())
|
selection = sublime.Region(0, self.view.size())
|
||||||
self.change_syntax()
|
selected_entire_file = True
|
||||||
else:
|
else:
|
||||||
selection = region
|
selection = region
|
||||||
|
|
||||||
|
@ -39,6 +42,9 @@ class PrettyjsonCommand(sublime_plugin.TextCommand):
|
||||||
separators=(',', ': '),
|
separators=(',', ': '),
|
||||||
use_decimal=True))
|
use_decimal=True))
|
||||||
|
|
||||||
|
if selected_entire_file:
|
||||||
|
self.change_syntax()
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
import sys
|
import sys
|
||||||
exc = sys.exc_info()[1]
|
exc = sys.exc_info()[1]
|
||||||
|
|
Loading…
Reference in New Issue