-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Text compare: Format text before comparing #1662
Description
What improvement do you think would an existing feature or tool in DevToys?
Many times a day, I have to copy some json or xml that comes in a single line, paste it into the respective formatter, copypaste the result into the text compater, then do the whole thing for the second one too.
I'd like a way of doing this directly, or more quickly, so I don't have to move back and forth between the tools.
Solution/Idea
Ideal for my use case (and possibly too specific) would be a "Paste JSON" and "Paste XML" button added next to the "Paste" button, that format the text before inserting it into the input field. That way I can copy one text, paste it into DevToys, copy the second text, paste it into DevToys.
Another more general solution would be some kind of pipeline feature, configurable through GUI or maybe json:
Tools have one or multiple inputs, options, and outputs.
A pipeline could define:
- Pipeline inputs (list of names/ids, in my case 2: "JsonLeft", "JsonRight")
- one or more pipe targets:
- which tool is called (in my case JsonFormatter two times, then TextCompare)
- which previous data point (initially, pipeline inputs. In the middle, previous outputs) (in my case the pipelines inputs, then the formatter outputs)
- goes to the tool's input
- with which options for that tool (in my case sorting: false for the formatter and inline: false for the comparer)
- what to call the outputs (FormattedLeft/FormattedRight for the formatter, then CompLeft/CompRight for the comparer)
- Pipeline outputs (list of names/ids of previous outputs, optionally stack direction of vertical or horizontal)
Example pipeline:
{
"pipeline": {
"name": "JsonComparePipeline",
"inputs": [
{ "id": "JsonLeft", "name": "Left JSON Input" },
{ "id": "JsonRight", "name": "Right JSON Input" }
],
"pipes": [
{
"tool": "JsonFormatter",
"input": "JsonLeft",
"options": { "sorting": false },
"output": "FormattedLeft"
},
{
"tool": "JsonFormatter",
"input": "JsonRight",
"options": { "sorting": false },
"output": "FormattedRight"
},
{
"tool": "TextCompare",
"inputLeft": "FormattedLeft",
"inputRight": "FormattedRight",
"options": { "inline": false },
"outputLeft": "CompLeft",
"outputRight": "CompRight"
}
],
"outputs": [
{ "id": "CompLeft", "name": "Left Comparison Output" },
{ "id": "CompRight", "name": "Right Comparison Output" }
],
"stackDirection": "horizontal"
}
}Then I would build the same for the XmlFormatter.
Comments
I made up the names of the tools, I didn't actually look for IDs or anything in the code.