adding ensure_ascii to configuration, and renaming configuration variable indent_size to indent. it's possible to specify not only the size of spaces but also string
This commit is contained in:
parent
cb43119624
commit
d529976ca0
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"use_entire_file_if_no_selection" : true,
|
||||
"indent_size" : 4,
|
||||
"sort_keys" : false
|
||||
"indent" : 4,
|
||||
"sort_keys" : false,
|
||||
"ensure_ascii" : false
|
||||
}
|
|
@ -27,6 +27,6 @@ class PrettyjsonCommand(sublime_plugin.TextCommand):
|
|||
|
||||
try:
|
||||
obj = json.loads(self.view.substr(selection), object_pairs_hook=OrderedDict)
|
||||
self.view.replace(edit, selection, json.dumps(obj, indent=s.get("indent_size", 4), ensure_ascii=False, sort_keys=s.get("sort_keys", False), separators=(',', ': ')))
|
||||
self.view.replace(edit, selection, json.dumps(obj, indent=s.get("indent", 4), ensure_ascii=s.get("ensure_ascii", False), sort_keys=s.get("sort_keys", False), separators=(',', ': ')))
|
||||
except Exception, e:
|
||||
sublime.status_message(str(e))
|
||||
|
|
14
README.md
14
README.md
|
@ -18,9 +18,21 @@ If JSON is not valid it will be displayed in status bar of sublime.
|
|||
|
||||
**use_entire_file_if_no_selection** - true
|
||||
|
||||
**indent_size** - 4
|
||||
**indent** - 4
|
||||
|
||||
**sort_keys** - false
|
||||
|
||||
**ensure_ascii** - false
|
||||
|
||||
## Using tabs for indentation
|
||||
|
||||
You can change configuration key **indent** to string value "\t" or any other string.
|
||||
|
||||
```
|
||||
"indent_size" : "\t",
|
||||
```
|
||||
|
||||
Be sure "Indent Using Spaces" is unchecked otherwise you will not see effect and ST2 will convert it back to spaces.
|
||||
|
||||
## Thanks
|
||||
https://github.com/the3rdhbtaylor
|
||||
|
|
Loading…
Reference in New Issue