Skip to content

Commit b7d6756

Browse files
committed
Add unfolding command to tree; fix RemesPath bug
ADDED - "Make this visible" option to tree view's right click context menu to undo code folding in Notepad++ as necessary to make the node visible in the editor. Responds to issue #103. FIXED - Bug where s_join in RemesPath would treat some non-strings as empty strings, rather than correctly throwing an error. CODEBASE (no change to public API) - Removed the unnecesary IScintillaGateway interface, because it makes no sense to create an interface that will only have one implementation. Now all references to IScintillaGateway instead go to ScintillaGateway. - In CI_build.yml, update actions/checkout to v6, addressing dependabot PR #109. DOCS - Make docs for the "Dump selected..." commands easier to read.
1 parent 25439b2 commit b7d6756

26 files changed

Lines changed: 143 additions & 2806 deletions

.github/workflows/CI_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: Checkout repo
25-
uses: actions/checkout@v5
25+
uses: actions/checkout@v6
2626

2727
- name: Add msbuild to PATH
2828
uses: microsoft/setup-msbuild@v2.0.0

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
5252

5353
## [9.0.0] - (UNRELEASED) YYYY-MM-DD
5454

55+
### Added
56+
57+
1. New [`Make this visible` option](/docs/README.md#reveal-tree-nodes-hidden-by-code-folding-added-in-v9) on the tree view's right click context menu to reveal nodes hidden by code folding. This was first requested in [issue 103](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/103).
58+
5559
### Fixed
5660

5761
1. __Correctly parse all ANSI files.__ Previously JsonTools assumed that Notepad++ used UTF8 to internally represent every document, and while that appears to have worked fine for most encodings, it would specifically fail on ANSI-encoded documents containing non-ASCII.
@@ -64,6 +68,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6468
3. Minor bug where some JsonGrepper tests would always fail because they queried an external API that had previously returned JSON but now returns HTML.
6569
4. Bug where editing a document in [multi-selection mode](/docs/README.md#working-with-selections) would sometimes cause selections to be forgotten (fixed in [v8.4.0.3](https://github.com/molsonkiko/JsonToolsNppPlugin/commit/16f0358274c662273a2015994c5ab22d22fd23ab))
6670
5. Bug ([issue 104](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/104)) where [error form](/docs/README.md#error-form-and-status-bar) would not always re-parse the document after the `Refresh with current errors` right-click context menu item on the error form was clicked.
71+
6. Bug where [`s_join` RemesPath function](/docs/RemesPath.md#non-vectorized-functions) would not throw an exception when the second argument was an array containing non-strings (previously it would silently treat nulls, objects and arrays as though they were empty strings).
6772

6873
## [8.4.0] - 2025-05-04
6974

JsonToolsNppPlugin/Forms/TreeViewer.Designer.cs

Lines changed: 23 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JsonToolsNppPlugin/Forms/TreeViewer.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public partial class TreeViewer : Form
9999
private static MouseEventHandler selectThisHandler = null;
100100
private static MouseEventHandler showSortFormHandler = null;
101101
private static MouseEventHandler selectAllChildrenHandler = null;
102+
private static MouseEventHandler makeThisVisibleHandler = null;
102103

103104
public TreeViewer(JNode json)
104105
{
@@ -1142,12 +1143,24 @@ private void Tree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
11421143
sortFormOpenItem.Visible = false;
11431144
selectAllChildrenItem.Visible = false;
11441145
}
1146+
var makeThisVisibleItem = NodeRightClickMenu.Items[7];
1147+
makeThisVisibleItem.MouseUp -= makeThisVisibleHandler;
1148+
makeThisVisibleHandler = new MouseEventHandler(
1149+
(s2, e2) =>
1150+
{
1151+
int posOfNode = NodePosInJsonDoc(node);
1152+
int lineOfNode = Npp.editor.LineFromPosition(posOfNode);
1153+
Npp.editor.EnsureVisible(lineOfNode);
1154+
Npp.editor.GotoPos(posOfNode);
1155+
}
1156+
);
1157+
makeThisVisibleItem.MouseUp += makeThisVisibleHandler;
11451158
NodeRightClickMenu.Show(MousePosition);
11461159
}
11471160
if (Translator.TryGetTranslationAtPath(new string[] {"forms", "TreeViewer", "controls"}, out JNode controlsTranslationsNode)
11481161
&& controlsTranslationsNode is JObject controlTranslations)
11491162
{
1150-
string[] controlNames = new string[] { "CopyValueMenuItem", "CopyKeyItem", "CopyPathItem", "ToggleSubtreesItem", "SelectThisItem", "OpenSortFormItem", "SelectAllChildrenItem" };
1163+
string[] controlNames = new string[] { "CopyValueMenuItem", "CopyKeyItem", "CopyPathItem", "ToggleSubtreesItem", "SelectThisItem", "OpenSortFormItem", "SelectAllChildrenItem", "MakeThisVisibleItem" };
11511164
for (int ii = 0; ii < controlNames.Length; ii++)
11521165
{
11531166
string name = controlNames[ii];

JsonToolsNppPlugin/Forms/TreeViewer.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
126126
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
127127
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACw
128-
DgAAAk1TRnQBSQFMAgEBDwEAAdABAQHQAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
128+
DgAAAk1TRnQBSQFMAgEBDwEAAdgBAQHYAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
129129
AwABQAMAAUADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
130130
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
131131
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

JsonToolsNppPlugin/JSONTools/RemesPathFunctions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,9 @@ public static JNode StringJoin(List<JNode> args)
19791979
for (int ii = 1; ii < itbl.Length; ii++)
19801980
{
19811981
sb.Append(sep);
1982-
sb.Append((string)itbl[ii].value);
1982+
if (!(itbl[ii].value is string s))
1983+
throw new RemesPathException($"Element {ii} of the array had type {JNode.FormatDtype(itbl[ii].type)}, but the array must contain only strings.");
1984+
sb.Append(s);
19831985
}
19841986
return new JNode(sb.ToString(), Dtype.STR, 0);
19851987
}

JsonToolsNppPlugin/JsonToolsNppPlugin.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@
121121
<Compile Include="PluginInfrastructure\DllExport\DllExportAttribute.cs" />
122122
<Compile Include="PluginInfrastructure\Docking_h.cs" />
123123
<Compile Include="PluginInfrastructure\GatewayDomain.cs" />
124-
<Compile Include="PluginInfrastructure\IScintillaGateway.cs" />
125124
<Compile Include="PluginInfrastructure\MenuCmdID_h.cs" />
126125
<Compile Include="PluginInfrastructure\Msgs_h.cs" />
127126
<Compile Include="PluginInfrastructure\NotepadPPGateway.cs" />

0 commit comments

Comments
 (0)