#71 ~ way to turn off validation on save

This commit is contained in:
Nikolajus 2016-07-18 10:38:10 +02:00
parent 3a3d95994d
commit 66c302caa4
3 changed files with 8 additions and 3 deletions

View File

@ -7,5 +7,6 @@
"value_separator": ": ", "value_separator": ": ",
"keep_arrays_single_line": false, "keep_arrays_single_line": false,
"max_arrays_line_length": 120, "max_arrays_line_length": 120,
"pretty_on_save": false "pretty_on_save": false,
"validate_on_save": true
} }

View File

@ -12,8 +12,9 @@ s = sublime.load_settings("Pretty JSON.sublime-settings")
class PrettyJsonLintListener(sublime_plugin.EventListener, PrettyJsonBaseCommand): class PrettyJsonLintListener(sublime_plugin.EventListener, PrettyJsonBaseCommand):
def on_post_save(self, view): def on_post_save(self, view):
# will work only in json syntax # will work only in json syntax and once validate_on_save setting is true
if "JSON" in view.settings().get('syntax'): validate = s.get("validate_on_save", True)
if validate and "JSON" in view.settings().get('syntax'):
self.view = view self.view = view
self.view.erase_regions('json_errors') self.view.erase_regions('json_errors')

View File

@ -80,6 +80,9 @@ http://stedolan.github.io/jq/
**pretty_on_save** - false **pretty_on_save** - false
`do we need to automatically Pretty JSON on save` `do we need to automatically Pretty JSON on save`
**validate_on_save** - true
`do we need validate JSON files on each save`
## Using tabs for indentation ## Using tabs for indentation
You can change configuration key **indent** to string value "\t" or any other string You can change configuration key **indent** to string value "\t" or any other string