I am trying to map a custom shortcut to VS code that will paste the following string (which clears the console), using the multi_command tool:
"command": "multiCommand.clearConsole",
"sequence": [
{
"command": "type",
"args": {
"text": "print("\\033\[2J)
}
}
]
I have used a double backslash to escape the first backslash, but I need a way of escaping the '[' open bracket.
Does anyone know if it's possible? or an easier way to do it? I just want to clear the console which is hosted on an external device (interacting via PyCOM Console) and interacts via python command line.
Cheers!
You need to escape the double-quote and the backslash before [
, the bracket is a valid JSON character:
{
"command": "multiCommand.clearConsole",
"sequence": [{
"command": "type",
"args": {
"text": "print(\"\\033\\[2J)"
}
}]
}