diff --git a/PrettyJson.py b/PrettyJson.py index df72059..1422d48 100644 --- a/PrettyJson.py +++ b/PrettyJson.py @@ -37,7 +37,7 @@ def check_jq(): jq_path = shutil.which(jq_test) jq_exists = True except OSError as ex: - print(str(ex)) + sublime.message_dialog(f'[Error]: {ex}') jq_exists = False @@ -240,8 +240,8 @@ class PrettyJsonCommand(PrettyJsonBaseCommand, sublime_plugin.TextCommand): if region is None: continue + selection_text = self.view.substr(region) try: - selection_text = self.view.substr(region) obj = self.json_loads(selection_text) json_text = self.json_dumps(obj=obj, minified=False) diff --git a/PrettyJsonListeners.py b/PrettyJsonListeners.py index 573dabd..7311113 100644 --- a/PrettyJsonListeners.py +++ b/PrettyJsonListeners.py @@ -13,7 +13,6 @@ class PrettyJsonLintListener(sublime_plugin.EventListener, PrettyJsonBaseCommand as_json = s.get("as_json", ["JSON"]) if any(syntax in view.settings().get("syntax") for syntax in as_json): - self.view = view self.clear_phantoms() json_content = view.substr(sublime.Region(0, view.size())) try: diff --git a/README.md b/README.md index a534c84..0b4c04c 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,20 @@ Prettify/Minify/Query/Goto/Validate/Lint JSON plugin for Sublime Text 3 & 4 +## Updates + +All keybindings have been removed in favor of the Command Palette. And to allow +for users to configure their own specific key bindings. + +This also prevents key binding overrides which conflict with other packages. For +good documentation on key bindings I recommend you review the [Offical Docs][] or +[Community Docs][] + ## Installation ### Package Control (Recommended) -Install this sublime text 3/4 package via [Package Control][] +Install this sublime text 3 / 4 package via [Package Control][] search for package: "[**Pretty JSON**][]" ### Manual Installation @@ -29,13 +38,7 @@ No longer supported ## Usage To prettify JSON, make selection of json -(or else it will try to use full view buffer) and press keys: - -- Linux: ctrl+alt+j -- Windows: ctrl+alt+j -- OS X: cmd+ctrl+j - -or through Command Palette Ctrl+Shift+P +(or else it will try to use full view buffer) and through Command Palette Ctrl+Shift+P find "Pretty JSON: Format JSON" (you can search for part of it like 'pretty format') @@ -192,3 +195,6 @@ If you YAMLing then maybe you interested in this plugin: [PrettyYAML][] [**Pretty JSON**]: https://packagecontrol.io/packages/Pretty%20JSON [PrettyYAML]: https://github.com/aukaost/SublimePrettyYAML [./jq]: http://stedolan.github.io/jq/ +[Offical Docs]: https://www.sublimetext.com/docs/key_bindings.html +[Community Docs]: https://docs.sublimetext.io/guide/customization/key_bindings.html +