Releases: molsonkiko/JsonToolsNppPlugin
Releases · molsonkiko/JsonToolsNppPlugin
v8.3.1: Fix crash with empty RemesPath queries; properly raise error for more bad RemesPath queries
v8.3.1: Fix crash with empty RemesPath queries; properly raise error for more bad RemesPath queries
Latest
[8.3.1] - 2024-12-22
Fixed
- Fixed bug where running a RemesPath query in the tree view would cause a crash if the query box was empty or contained only whitespace.
- Fixed bug where some errors would not be raised on some syntactically invalid RemesPath queries containing two valid items not separated by a binary operator. For example,
1 * -2 7
andbar + @[0] 9
both had this problem.
v8.3: *fully fix* decimal formatting, allow parse \u0000 and \x00, minor improvements
[8.3.0] - 2024-12-22
Changed
- Use a different algorithm for representing decimal numbers to fix issues 83 and 81 on computers where v8.2 had not fixed those issues.
- As an unfortunate consequence of this fix, a very very small percentage of very high-precision decimal numbers will lose precision using this new algorithm. The vast majority of numbers with 17 digits of precision (the maximum precision attainable by JsonTools) will not lose precision when reformatted by JsonTools. For example, JsonTools will pretty-print
-6553693.3617752995
as the lower-precision-6553693.3617753
. However, note that JsonTools still handles high-precision doubles better than the JSON-Viewer plugin.
- As an unfortunate consequence of this fix, a very very small percentage of very high-precision decimal numbers will lose precision using this new algorithm. The vast majority of numbers with 17 digits of precision (the maximum precision attainable by JsonTools) will not lose precision when reformatted by JsonTools. For example, JsonTools will pretty-print
- Automatic parsing after editing and automatic JSON schema validation on opening a file no longer makes the error form visible if the user had previously opened the error form and then hid it.
- Tree view icon and menu item check are now correctly toggled depending on whether a tree view (other than the grepper form's tree view) is visible. This doesn't matter much, since multiple tree views can be open and a tree view that is not visible could become visible again, but it is a nice visual cue.
Fixed
- When a file is pretty-printed or compressed or edited with RemesPath, the caret will be scrolled into view. Previously, if the file contained very long lines and word wrapping was turned off, the user might have to manually scroll to the left after pretty-printing or compressing.
- NUL characters (when rendered as
\u0000
or\x00
) can now be parsed. Previously they raised a fatal error.
v8.2: fix decimal formatting, rename tree views, many bugfixes
[8.2.0] - 2024-11-09
Added
- When a file is renamed, the name of a tree view associated with that file also changes to match the new name. This also happens when a treeview is refreshed with JSON from a different file.
- Add
rand_schema
RemesPath function to generate random JSON from schema.
Changed
- If a number string is too large or small for a 64-bit floating point number (for example,
-2e700
,3.5e+450
), the JSON parser will now represent them as-Infinity
(if they have a leading-
sign) orInfinity
, rather than representing them asNaN
. The linter also has a new message for when this happens. - If a JSON lines document is not compliant with the strict JSON specification, the status bar will now reflect that it is JSON lines.
- Stop considering the user's Windows culture when determining the UI language for JsonTools (fix issue 82). Now JsonTools will be translated into language X if and only if Notepad++ is in language X.
Fixed
- Fix issue (introduced in v8.1, see issues 83 and 81) where decimal numbers were given unnecessarily precise string representations. For example, in JsonTools v8.1,
11.11
would be represented as11.109999999999999
even though the original11.11
was an equally valid representation. Now all decimal numbers will be given the more compact representation used in v8.0 and earlier unless the more verbose representation introduced in v8.1 would be necessary to avoid loss of precision (so there will be no regression on issue 78). Note that this new algorithm for formatting decimal numbers is about twice as slow as the algorithm used in v8.1 (for 64-bit JsonTools; 32-bit has no performance loss), although the impact on performance will be much less dramatic unless you are compressing an array where almost every element is a non-integer decimal number. - Fix the following issues with random string from regex:
- It previously incorrectly flagged some valid regular expressions (e.g.
(?-i)(?:xy{1,2}){,2}
) as having two consecutive quantifiers. - It previously did not correctly handle some character sets where the final character was
-
(for example,[+-]
previously would only generate+
, and now it correctly has a 50% chance of generating-
or+
)
- It previously incorrectly flagged some valid regular expressions (e.g.
- Fix issue where RemesPath incorrectly inferred the type of (a function
fun
followed by indexers) to be the return type offun
. For example, running the querysum(dict(items(@)).a)
on the JSON{"a": [1]}
now correctly returns1.0
, but RemesPath used to raise an error because it assumed thatdict(items(@)).a
had the same type asdict(items(@))
- Fix very rare crash bug when using the
Value to clipboard
option of the tree node right-click context menu. - Fix bug where some invalid JSON Lines documents (for example,
[1, \n2][3]
) would be accepted by the JSON Lines parser despite having elements that span multiple lines. - Fix minor bugs with how headers are formatted in the
s_csv
RemesPath function and JSON-to-CSV form. - Fix bug where renaming a file subject to schema validation based on filename patterns would cause its tree view to be lost.
- Fix bug where plugin actions (mainly RemesPath queries in regex mode) that set the text of the entire document to an empty string would not do anything. Those actions will now correctly remove all the text in the document.
- Fix issue 79 where, on higher display resolutions than the default 125% normally used by molsonkiko in development, some of the advanced controls in the find/replace form would not be visible.
- Fix annoying but harmless bug where, if the user had two views open and ran a plugin command on one or more selections in the second view, the indicator that JsonTools uses to remember selections (which is supposed to be hidden at all times) would cause the selections to be underlined.
- Address issue 80; now error form will be cleared of errors when the JSON parser does not log any syntax errors.
- Make it so that JSON Lines documents are correctly formatted as JSON Lines after sorting by the sort form.
- Make it so that refreshing a tree view originally associated with
oldFile
with JSON fromnewFile
will correctly cause the tree view to be associated withnewFile
. Previously, the tree view stayed associated witholdFile
, so attempting to open a new tree view foroldFile
would instead close the tree view now associated withnewFile
, because the command to open a tree view for a file closes that file's tree view if it already has an open one.
v8.1: improve "JSON from Files and APIs" form; improve translations; random string from regex; fix many bugs
[8.1.0] - 2024-08-23
Added
- Progress reporting with the JSON from files and APIs form (henceforth the
grepper form
). - In the
grepper form
, pressingEnter
inside thePreviously viewed directories...
box causes the current text of the box to be searched, assuming that it is a valid directory. - Translation of the following:
- Settings in the Settings form.
- JSON syntax errors and JSON schema validation errors (under the
jsonLint
field of the translation file) - Generic Windows message boxes (the boxes with
Ok
,Yes
,No
, andCancel
buttons and no other controls).
- The
path_separator
setting for formatting keys/indices and paths. Addresses issue 69. - Make it so left-clicking on the
Key/index to clipboard
andPath to clipboard
options of the treenode right-click context menu gets the path or key/index in whatever the default is from your settings, without having to click on one of the sub-menu items. - The
grepper form
now supports\
and/
(path separators) in search patterns, as well as**
to match any number of characters (including\
). - Generation of random strings from regular expressions.
- The
grepper form
now reads and parses all files asynchronously, and can be canceled. - While the
grepper form
is working on a request, it now ignores clicks on the API request button and the Search directories button.
Changed
- Rename
Choose schemas to automatically validate filename patterns
toValidate files with JSON schema if name matches pattern
, in the hopes that the new name will be less confusing. - Changed the wording of many JSON syntax error messages to be more consistent, per conky77's suggestion here.
- When attempting to translate to other languages, JsonTools now checks the UI language of Notepad++ before checking the Windows UI culture.
- When automatic validation after editing is turned on, only modifications that change the text of the document will trigger re-parsing.
Fixed
- If there would be an
OutOfMemoryException
due to running out of memory while formatting JSON (a likely occurrence when using thegrepper form
), that error is caught and reported with a message box, rather than potentially causing Notepad++ to crash. - Ensure that hitting the down key does nothing when the last row of the error form is selected.
- Fix bug with random json from schema when parsing a schema that has the
enum
key but not thetype
key. - Make it so JsonTools simply does nothing rather than causing Notepad++ to crash when attempting to run plugin commands on files with more than 2147483647 bytes.
- Fixed number precision bug (issue 78).
- Rare bug generating schemas from JSON, only seen with some arrays of objects.
- Rare crash when saving
schemasToFnamePatterns.json
if automatic validation after editing is enabled. - Changes to the
max_schema_validation_problems
setting will apply immediately, including to previously compiled JSON schemas. - Unrecoverable crash due to stack overflow when generating random JSON from a recursive schema.
v8.0: add translation to other languages; improve tree view UI; remove some minor settings
[8.0.0] - 2024-06-29
Added
- Made it possible to translate JsonTools into other languages.
- Made the tree view font size configurable with the
tree_view_font_size
setting. Fixes issue 66. - Added dark mode tree view icons (addresses this GH issue comment).
- Allow users to manually enter directory names in the JSON from files and APIs form (referred to as "grepper form" for the rest of this section) rather than using a dialog or the dropdown menu.
- Added a "Search directories" button to the grepper form.
Changed
- Removed the
max_threads_parsing
setting for the grepper form, because the underlying implementation was changed in a way that made that setting useless. - Removed the
allow_datetimes
setting, because I do not feel confident that the potential benefits of the setting outweigh the danger of accidentally changing the format of people's dates or datetimes in some way that they were not expecting. - When all files have been parsed in the directory chosen with the grepper form, the directory name is no longer reset to the default value.
- Added a hard limit to the total combined size of all files parsed by the grepper form, to avoid hitting memory errors.
Fixed
- Avoid unnecessarily refreshing the styles of all forms when settings other than
use_npp_styling
ortree_view_font_size
are changed. - The list of recently chosen directories in the grepper form is pre-filtered for existing directories, to hide the partial directory names that contaminate the config file.
- Fix bug where, if a setting in the config file had an invalid value (for example, a numeric setting having a value of
blah
), there might be an uncaught exception that would cause Notepad++ to crash. This bug appeared to be most likely to occur when the localization is not set toen-us
.
v7.2: fix various bugs; add "Check JSON syntax now" command
[7.2.0] - 2024-04-19
Added
Changed
- Made it so that reloading the error form by pressing
Enter
would not cause certain message boxes to appear, to eliminate a potential "infinite" loop where the user would hitEnter
to close the message box, and that moved focus back to the error form, which then repeated the cycle when they lifted theEnter
key. - Automatic validation when
auto_validate
is true no longer opens the prompt asking if user wants to open the error form (ifoffer_to_show_lint
is true), because that could cause Notepad++ to crash or hang forever (see issue 60). - Made it so that automatic JSON schema validation (that is, any validation not manually invoked by the plugin menu command) no longer causes the caret to move to the location of the first schema validation error.
- Automatic validation (including non-schema validation) now refreshes the error form.
Fixed
- Minor bug in PPrint remembering comments algorithm implementation that caused some arrays and objects to be compressed when they should have been pretty-printed.
- Fix bug where tests could crash under some circumstances due to filesystem weirdness making it impossible to find test files.
v7.1: improve selection-based mode, fix issues with Notepad++ 8.6.5+, fix many other bugs
Added
minLength
andmaxLength
keywords are now considered when making random JSON from schema- JsonTools now automatically navigates to the location of the fatal error when it fails to parse a document, unless the attempted parse was auto-triggered (say, by the automatic parse after editing)
- Selection-based mode now supports any number of remembered selections, and undo and redo actions usually do not cause selections to be forgotten. Performance also appears to be better.
Changed
- If the location of an error is between the
CR
and theLF
of aCR LF
newline, JsonTools will now always move before theCR
, rather than placing the caret in between them, which could cause confusion. - Automatic JSON schema validation after editing does not happen when the document is in
REGEX
mode. - Removed the
max_tracked_json_selections
setting, as it is no longer necessary.
Fixed
- Using the Notepad++ find/replace form in Notepad++ versions 8.6.3 and 8.6.4 now appropriately shifts remembered selections when in selection-based mode.
- Bug where the space key did not work on the regex search form.
- Bug where automatic JSON schema validation after editing sometimes caused a deadlock that disabled some functionalities until Notepad++ closed.
- Possible plugin crash due to index-out-of-bounds error during parsing of JSON Lines.
v7: json schema validation finds multiple errors, better pretty-print w/ comments, regex form guesses CSV parameters, RemesPath improvements
[7.0.0] - 2024-02-09
Added
- PPrint-style pretty-printing that remembers comments
- Add
and
andor
non-vectorized functions in RemesPath, which both use conditional excution. - Add
s_format
vectorized RemesPath function, for easy reformatting of JSON strings. - Python-style single-line comments in RemesPath
- A RemesPath user-defined language (UDL) file, providing some very basic syntax highlighting. It is buggy, but that is because the UDL system is inherently buggy, not because I did anything wrong (as far as I know).
- A
:
character between two key-value pairs in an object no longer causes a fatal error that makes the parser quit. - Add new
auto_try_guess_csv_delim_newline
setting. If this is true (default false), Regex search form now makes a very basic attempt to "sniff" if the current file is CSV whenever it is opened, or when theParse as CSV?
button is toggled on.
Changed
- Support for multiple JSON schema validation problems
- All RemesPath regular expressions are now multiline, meaning that
^
and$
now match the start and end of lines respectively, rather than the start and end of the document. - The
ifelse
vectorized function in RemesPath now uses conditional execution. - Default value for
sort_keys
setting is nowfalse
, meaning keys are left in their original order by default. This will not change existing settings. - Add optional arguments to
stringify
non-vectorized function in RemesPath, so that users can control the format of the output. - Make dark mode icons darker.
- This change only affects the code base, not the public API: changed almost all snake_case variable names to camelCase. RemesPath functions still use snake_case (e.g.,
s_mul
andgroup_by
still have those names), and all the settings in Settings.cs (e.g.,use_npp_styling
) that were previously snake_case are still snake_case. - Automatic linting after edits is now disabled while in selection-based mode.
- Automatic linting after edits will always attempt to parse the entire document, even if the user has made a selection that could be parsed as JSON.
- Numbers with unnecessary leading 0's (like
01
or002.5
) are now logged at theBAD
level, and numbers with trailing decimal points are now logged at theJSON5
level. - Error form keypress triggers now execute when the key is released, rather than when it is depressed.
- Automatic JSON schema validation now ignores the user's selections and always validates the entire document.
Fixed
- Fixed issue where vectorized functions in RemesPath were not vectorized across objects if the first argument was a function of input and at least one of the non-first arguments was also a function of input.
- Fixed issue where entering invalid text into comboboxes in the regex search form and grepper form could cause a (mostly harmless) plugin crash.
- Improved refresh and loading speed for tree viewer on very large files in regex mode.
- Fix issue where tree view tracking of capture groups in regex search mode was wrong in some cases involving non-ASCII characters.
- Hitting
Escape
in the error form moves focus to the editor component. - When logging errors in selection-based mode, the error form now navigates to the location of the error in the overall document. Previously it navigated to the location of the error relative to the start of the selection.
- The regex search form no longer closes the currently active tree viewer when you focus or open it.
- Register forms (other than the modal AboutForm and JSON-to-CSV form) with Notepad++ using NPPM_MODELESSDIALOG. This permanently fixes the regression in Notepad++ 8.6.1 where Ctrl+X and Ctrl+C stopped working in textboxes.
v6.1.1: improve error form, f-strings and new funcs in RemesPath, better RemesPath error msgs, fix misc bugs
[6.1.1] - 2023-12-28
Fixed
- Eliminated potentially unrecoverable plugin crash when JSON parser tries to parse document with
-
or+
not followed by numeric chars (e.g.-a
,+
). Now such badly formatted numbers are parsed asNaN
.
[6.1.0] - 2023-12-28
Added
- Python-style f-strings in RemesPath.
s_cat
RemesPath non-vectorized function.s_lines
,s_lpad
,s_rpad
, andzfill
RemesPath vectorized functions.Select all children
treenode action now works for root treenode in JSON Lines and selection-based documents.
Changed
- RemesPath syntax errors (anything caught by the lexer) now use
>>>HERE>>>
before the character where the error occurred, similar to how the Notepad++ find/replace form indicates the location of a regular expression syntax error. - Not part of public-facing API: Renamed the
JQueryContext.Evaluate
method toJQueryContext.Operate
, and renamedJMutator.Mutate
toJMutator.Operate
. - Make it so automatic validation does not require the document to be re-parsed as JSON, and is suppressed when in regex or ini mode.
Fixed
- Eliminated plugin crash when attempting to open the regex search form after it had been closed.
- Greatly improved error form reloading performance.
- Some UI test failures (and probably related weirdness in public API) on older NPP versions
- Fix bug where
s_csv
RemesPath function did not properly handle delimiters that were regex metacharacters like|
v6: TREE VIEW WORKS FOR REGEX SEARCH AND CSV, parser improvements, error form improvement, many bugfixes
Added
- Option to customize which toolbar icons are displayed, and their order.
- New regex search form for using treeview to see regex search results in any file.
- New document type list box in tree view
- For loops in RemesPath
bool
,num
,s_csv
ands_fa
RemesPath vectorized arg functionsrandint
,csv_regex
,set
, andto_csv
RemesPath non-vectorized arg functions- Make second argument of
s_split
RemesPath function optional; 1-argument variant splits on whitespace. - Right-click dropdown menu in error form, allowing export of errors to JSON or refreshing the form.
- The JSON parser is now much better at recovering when an object is missing its closing
'}'
or an array is missing its closing']'
. - Support for JSON Schema validation of
enum
keyword where thetype
is missing or an array. Ctrl+Up
now snaps to parent of currently selected node in tree view.Ctrl+Down
now snaps to the last direct child of the currently selected node.
Changed
- The internal representation of object keys has changed to allow unescaped strings as keys (THIS DOES NOT AFFECT THE PUBLIC API EXCEPT IN SOME CORNER CASES IN REMESPATH).
- What I mean by this is that previously the key in the JSON object
{"\"": 3}
was previously internally represented as"\\\""
, with the quote character escaped as shown. - This had the advantage of making it slightly faster to display object keys (e.g., when pretty-printing/compressing/dumping), but made it impossible for certain strings to be valid object keys, in a way that could not be detected except when pretty-printing or compressing.
- Under the new system as of this version, all strings are acceptable as object keys. This has positive implications for RemesPath, as it means that users do not need to remember to escape string JNodes before using them as keys in an object.
- What I mean by this is that previously the key in the JSON object
- When using the JSON-to-CSV form to create CSV files, newline characters will no longer be escaped in strings. This is one of several changes made in order to acheive compliance with RFC 4180.
- Made
offer_to_show_lint
setting (which controls whether a prompt is shown when errors are found) true by default, so that a fresh installation will show the prompt. - Change RemesPath indexers to reduce the number of backslash escapes needed to get keys containing special characters like
"a\\b"
or"\"foo\"\tbar"
. For instance, previously@.`\\n\\\\a\"`
would be required to match the key"\n\\a\""
, whereas now@.`\n\\a"`
matches it. - Running a RemesPath query only causes an attempted re-parsing of the document if the treeview's current file is open.
- Running a replace query on the find/replace form now causes the tree to display only the values that were mutated.
- Changed the tabstop order of some forms, made it so that the find/replace form has complete tabstop coverage, and eliminated some tabstop-related issues associated with combo boxes in some forms.
- Benchmarks for compiling RemesPath queries now more accurately represent the effect of caching on performance.
Fixed
- Fixed plugin crash when attempting to parse too-large hex numbers like
0x100000000000000000000
. Now the parser will fatally fail and add a lint indicating the issue, but the plugin will not actually crash. - Fixed some weird issues where mutating a variable in RemesPath could cause re-executing a query on the same input to return a different value. A minimal example:
var x = 1; x = @ + 1; x
would return 1 + (the number of times the query was executed) prior to this fix, but now it will always return2
as expected. This was also true of a bunch of other things in RemesPath, including projections and the map operator. - Fix issues where running a RemesPath query with a projection that referenced a variable indexing on a compile-time constant would cause an error. For example,
var x = @; 1->x
should return@
(the input to the query), but prior to this fix, it would instead cause an error. - Running tests would previously cause clipboard data to be lost irreversably. Now, if the user's clipboard contained text before running tests, the contents of the clipboard are restored to their pre-test values rather than being hijacked. Non-text data that was copied to the clipboard is still lost when running tests, and I may try to fix that in the future.
dict
function in RemesPath previously had a bug that could create invalid JSON if the strings to be turned into keys contained special characters (e.g., literal quote chars,\r
,\n
).- access violations when loading error form
- unnecessary prompt when manually reloading error form
- issue with trying to view error form when the error form was already open
- RemesPath backtick strings now can have a literal
\
character just before the closing backtick. Previously this was impossible because of a regex-writing bug. - Eliminated plugin crash when attempting to validate with an invalid JSON schema. Now a message box will show in that situation.