Commit Graph

55 Commits

Author SHA1 Message Date
TheSecEng 3f2841d109
implement: jq path setting 2020-04-17 22:43:01 -04:00
TheSecEng 6c52f846b5
fix: implement duplicate key detection 2020-04-17 18:46:26 -04:00
Terminal 6fd83df6b8
Merge pull request #112 from dzhibas/fix/st3/issue-109
Fix/st3/issue 109
2020-04-17 18:39:48 -04:00
TheSecEng 9d17ced7f5
implement: remaining fix for #109
remove: no-sublime-package
2020-04-17 17:22:19 -04:00
Terminal 4d199f3b93
Merge branch 'st3' into keep-arrays-single-line-fix 2020-04-17 15:42:32 -04:00
Terminal 7cf04726d2
Merge pull request #81 from yukixz/fix-one-line-array
Sort matches before replacment on post process
2020-04-17 15:40:24 -04:00
Terminal 966d66eb02
Merge pull request #80 from tadashi-aikawa/master
Fix issue #62
2020-04-17 15:38:43 -04:00
TheSecEng a261db2026
fix: issue #109 2020-04-17 15:33:46 -04:00
mrliaocn 210d6a3a45
Fix an array parse error
When parse an array with config `keep_arrays_single_line = true`, `output_json.replace(m, replacement)` will replace more than once if another array is a subset of current.
Example:
```{"a": [1],"b": [2,3,1]}```
should be parsed like: 
```
{
    "a": [1],
    "b": [2, 3, 1]
}
```
but actually got 
```
{
  "a": [1],
  "b": [
    2,
    3,1]
}
```
2019-12-23 16:59:39 +08:00
Randi Katrine Hillerøe 742b26b920
Issue with replacing more than wanted
When finding array matches only the content of the array is replaced. This content can potentially be present in multiple places and will then break later array replacements. The below example can reproduce the issue:
{
  "test": [3, 4],
  "test2": [1, 2, 3, 4],
  "test3": [3, 4]
}

With setting "keep_arrays_single_line": true

Basically the issue occurs for two arrays A, B where A is a suffix of B and A occurs earlier in the JSON document than B.
The fix is to match the whole array, not just the content. Then remove the brackets to split and join and re-add the brackets afterwards.
If the same array occurs multiple times then this will replace all instances during the first replace, however that should not cause any issues.
The fix prevents issues with replacing arrays that are subsets of other arrays.
2017-11-15 12:46:02 +01:00
Dazzy Ding 6e769bd62c Sort matches before replacment on post process 2017-02-18 19:41:53 +08:00
tadashi-aikawa 391ebd8a8c Fix issue #62 2016-12-18 21:14:12 +09:00
Nikolajus 3a3d95994d Sublime 2 compatible 2016-07-15 21:35:07 +02:00
Nikolajus 62bdb1d281 #56 symbol search / goto / jump to source cmd+r 2016-07-15 17:26:56 +02:00
Nikolajus a8648980af small change 2016-07-15 16:08:01 +02:00
Nikolajus 06e2e604b0 Adding linter on save if syntax set is JSON, change a bit of line highlighter 2016-07-15 15:57:39 +02:00
Nikolajus 31e47da8c1 #65 - naive version of single quote detection, and trying to replace them into double quotes and parse again 2016-07-15 01:40:17 +02:00
Nikolajus a054124590 moving max line length into config so people can change it 2016-07-15 01:03:35 +02:00
Nikolajus b3066c8014 simple regex just for line number, and some logic to highlight line above 2016-07-15 00:19:32 +02:00
Nikolajus 04296b2d13 #47 ~ adding support for folding array into single line if they are not reaching more than 120chars in a line 2016-07-14 18:26:13 +02:00
Nikolajus 6d08a51286 #68 ~ adding separate menu item to force sorting on demand 2016-07-14 17:02:25 +02:00
Nikolajus dd72cbfc96 #66 ~ moving line and value separators into config file, so people can change it easily to value they need 2016-07-14 16:34:19 +02:00
Nikolajus a5508b29ed #58 - fixing issue with input encoding on win32 platform 2015-12-07 15:50:38 +01:00
Nikolajus beb955f7c9 #54 - fixing issue with win32 and subprocess.Popen, stdin also needs to be piped. also removal of version check cause on win32 decoding throws exception and stops plugin 2015-12-07 15:41:57 +01:00
Jon Nolen 1864219b6b deferring check for jq until it is used, allows use of 'Fix Mac Path' plugin to fix path issues for homebrew 2015-12-04 13:38:51 -05:00
Nikolajus 5e455c6a0f Issue #50 fixed ~ adding validation command, in case of error view jumps to error 2015-05-29 17:50:39 +02:00
Nikolajus f5265b40a7 Small code refactoring to re-use code blocks + readme slight change 2014-06-05 09:58:00 +02:00
Nikolajus 9399ae5a22 Json 2 XML fix for ST2 2014-06-04 17:29:39 +02:00
Nikolajus 426aaab847 pep8 small fixes and fixing jQ to work on SublimeText 2. Definition of show_input_panel was wrong 2014-06-04 17:03:58 +02:00
Nikolajus 890459dc5d Json 2 XML feature. Fixing issue #34 2014-06-04 14:15:30 +02:00
Nikolajus 61c70ff185 issue #38 fixed 2014-06-03 20:56:35 +02:00
Nikolajus 7ef79ffed3 issue #33 fixed 2014-04-02 22:04:49 +02:00
Nikolajus 999c9e8e0d minor fixes: namings, documentation, rename of sublime command 2014-04-02 20:31:38 +02:00
Nikolajus 801cd85220 jq implementation 2014-04-02 12:44:23 +02:00
Nikolajus 5d2fad5b62 Fix issue #32 and issue #30 . adding command to compress/minify json into single line. Added test for it and travis for tests 2014-04-02 10:55:01 +02:00
Nikolajus fd69613832 Issue #22 change syntax only if json object was prettified 2013-06-19 12:43:39 +02:00
Nikolajus 5bf0c1f16d Fixing issue #22 and some indent fix for pep8 e128 2013-06-19 12:25:41 +02:00
Nikolajus a101fa0f12 Fixing issue #21 moving loading of configuration to async callback function plugin_loaded 2013-04-23 12:49:30 +02:00
Chris Castle d92e8bbe49 Allow PrettyJson.py plugin to work in both ST2 and ST3 2013-02-22 23:12:15 -08:00
Chris Castle 17cad98d95 Prepend simplejson import with 'module' name 2013-02-14 19:51:12 -08:00
Nikolajus 2472af646f Exception handling change to work in python 2.6 and 3 2013-02-14 09:44:03 +01:00
Nikolajus 18170f022e Added simple test and removed one import 2013-02-14 09:19:36 +01:00
Nikolajus b0d2f5ae66 Importing newest version of simplejson which wors with PY3 and 2.6, refactoring code to work only with simplejson. Issue #18 2013-02-13 10:19:30 +01:00
Nikolajus a3ed167787 Refactoring code to work with SublimeText3 and Python 3 thanks to @crcastle issue #18 2013-02-13 08:37:11 +01:00
Nikolajus 5ab38e46a6 Remove debug print of decoded object and change of default ident size to 2 2012-12-28 17:17:14 +01:00
Nikolajus d0bb576c75 Proper fix of issues #15 and #16 2012-12-28 17:12:53 +01:00
Nikolajus a00ddf43f1 fix issue #15 preserving real values as the user had it in json 2012-12-20 10:49:36 +01:00
Nikolajus d529976ca0 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 2012-10-09 15:57:06 +02:00
Nikolajus b14ec716e3 Adding copy of simplejson because package control is not suporting submodules, fixing issue #3 reordering of keys is disabled by default 2012-06-15 17:01:53 +02:00
Peter Gassner e3604b5f0c Configure json.dumps() to use an item separator of "," instead of the default ", " to prevent single whitespace at the end of lines.
Without this option, all prettyfied JSON has one space at the end of each line, which is not so pretty:

{
  "key": "value",_
  "key": "value",_
  "key": "value"
}

This could of course be configured, but with the current simplicity of the package it would probably be overkill.
2012-02-23 08:36:26 +01:00