I wrote a tool to do some processing on an input plain text file. I would like to use this tool from a task in VSCode sending as input a selection of this plain text file being edited in VSCode.
My input plain text file would be like:
This is a first line
This is line number two
This is the third one
etc...
So, there is a EOL at the end of every line. I would then select some of these lines and send them to the tool for processing via the task
I was thinking something along the lines:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Run tool on selection",
"type": "shell",
"command": "echo ${selectedText} > tmpFile.txt; mytool.exe tmpFile.txt ",
}
]
}
... but obviously this didn't work: myFile has not been created and I seem to also have problems echo-ing new lines. I also don't know whether there is a way of doing this without dumping the selection to a temp file. Can anyone help me set this up correctly? Thanks.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…