molsonkiko / JsonToolsNppPlugin

A Notepad++ plugin providing tools for JSON like linting, querying, a tree view, and CSV conversion.
Apache License 2.0
70 stars 9 forks source link

Add option to configure path seperator #69

Open Grisgram opened 2 weeks ago

Grisgram commented 2 weeks ago

Hi,

I know, it is pretty standard to use the . as seperator for json paths (like strings.legal.copyright), however I also have systems which would prefer a / as path seperator, like strings/legal/copyright.

Could you add an option to set a character as the path seperator? Leave it as . as default, so nothing changes for the current default behavior

Thanks!

molsonkiko commented 2 weeks ago

What is the context in which you would prefer / as path separator? I may or may not be able to help you.

If you are referring to the query box (for example, using @.foo.bar to select the bar field of the foo field of the current JSON), that is completely impossible, as . is hardcoded for that purpose in the RemesPath syntax.

If you are asking for a fourth option for the Path to current position command, with a configurable path separator defined in the settings, I would be willing to implement that.

Grisgram commented 2 weeks ago

I have a tool that accesses these json files at runtime and this tool expects a slash-seperated path to finally find a value in the struct. So, no, not the query-box. Just what you put into the clipboard with the "path to clipboard" or the path to current option, that you mentioned (or both).

I just right-click a node image

and then you generate something like "strings.legal.copyright" but for this tool i'd need "strings/legal/copyright" (either use the configurable seperator in the javascript style or add a menu option "custom style" which refers to the seperator set in the settings. either way is ok. I am working with quite large files and a deep structure -- it's a bit awkward to always manually replace all dots with slashes after pasting the path into my source code. The reason why i can not use the dot is, that these json files already use the dot in their keys image like this. And they get generated by another system which I have no control over.

I hope I could explain :-) Cheers!