Closed manoharreddyporeddy closed 2 years ago
@pucelle @davidolrik @BitFis
Yes, this plugin doesn't care about sequence, in fact all commands are started immediately, and in a parallel.
It seems easy to support command sequence. so, you may provide your scenarios, we can talk about it here.
Thanks for the reply.
Scenario:
On save
Expected ( but - should be in parallel - an option is needed)
{
"runOnSave.statusMessageTimeout": 3000,
"runOnSave.commands": [
{
"match": ".*\\.*",
"command": "editor.action.formatDocument",
"runIn": "vscode"
},
{
"match": ".*\\.*",
"command": "git.stageAll",
"runIn": "vscode"
}
]
}
I am forced to do below: Actual - currently i have this working, works fine but not optimal, as it runs outside the visual studio:
{
"runOnSave.statusMessageTimeout": 3000,
"runOnSave.commands": [
{
"match": ".*\\.*",
"command": "editor.action.formatDocument",
"runIn": "vscode"
},
{
"match": ".*\\.*",
"command": "ping -n 5 127.0.0.1 > nul 2>&1 && git add * > nul 2>&1",
"runIn": "backend"
}
]
}
Please let me know if you need more details.
Next step should be the configuration json, what type of json format you would prefer?
One of the below ways looks fine for me:
Solution Proposal 1
We could add an additional param async: true/false
like below ( this is similar to other run on save extensions )
async: true
should be parallel
(also when async
is not defined, it should be parallel, so it is backward compatible )async: false
should be sequence
{
"runOnSave.statusMessageTimeout": 3000,
"runOnSave.async": true, // <----------------------- parallel ( all below cmds will run at once )
"runOnSave.commands": [
{
"match": ".*\\.*",
"command": "editor.action.formatDocument",
"runIn": "vscode"
},
{
"match": ".*\\.*",
"command": "ping -n 5 127.0.0.1 > nul 2>&1 && git add * > nul 2>&1",
"runIn": "backend"
}
]
}
{
"runOnSave.statusMessageTimeout": 3000,
"runOnSave.async": false, // <----------------------- sequence ( all below cmds will run one by one / one after another )
"runOnSave.commands": [
{
"match": ".*\\.*",
"command": "editor.action.formatDocument",
"runIn": "vscode"
},
{
"match": ".*\\.*",
"command": "ping -n 5 127.0.0.1 > nul 2>&1 && git add * > nul 2>&1",
"runIn": "backend"
}
]
}
==================
Solution Proposal 2
Instead of point 1 above, we could just add a runInSequence: true
which will run the commands in sequence
{
"runOnSave.statusMessageTimeout": 3000,
"runOnSave.runInSequence": true, // <----------------------- sequence ( all below cmds will run one by one / one after another )
"runOnSave.commands": [
{
"match": ".*\\.*",
"command": "editor.action.formatDocument",
"runIn": "vscode"
},
{
"match": ".*\\.*",
"command": "ping -n 5 127.0.0.1 > nul 2>&1 && git add * > nul 2>&1",
"runIn": "backend"
}
]
}
===================
I would prefer the option 1, will implement it soon.
@pucelle thanks also we may need to consider the possibility of mixing both (parallel & sequence in a mix) just adding to keep in mind - can be added later
Just for design ideas, if any required:
Here we can assume parallel/concurrent are same for our purposes: . https://stackoverflow.com/a/46086037/984471
Previously I used to use a library that has series & parallel: . https://caolan.github.io/async/v3/docs.html#series . https://caolan.github.io/async/v3/docs.html#parallel
Parallel & sequence in a mix ( but per command ):
async is per object by other run on save: (if prese) . https://github.com/emeraldwalk/vscode-runonsave/blob/master/README.md#sample-config
I would prefer the option 1, will implement it soon.
@pucelle When it's done, please leave a comment here. thanks
Sure.
Released 1.5.0, should support async
configuration.
Sorry for the late fix and Thanks for your comments again.
This really helped me! well appreciated!
The docs does not talk about running in parallel or in sequence Looks like all are parallel
What if i want to run in sequence, below commands are same but run it two times (or, two different commands), in sequence How to do this?