Reputation: 229
I am new to VSCode, just started using workspaces.
I was wondering if there is a way to configure my workspace (named fun_projects), to automatically open two text files, as I open the workspace. Like as I open the workspace, I want two previously saved text files to open
Upvotes: 1
Views: 409
Reputation: 181449
You can make a task like this:
{
"version": "2.0.0",
"tasks": [
{
"label": "Open two files on workspace open or reload",
"type": "shell",
// -r flag re-uses the current vscode window
// note the double-escaping for this form of backslashed paths
"command": "code -r 'C:\\Users\\Mark\\OneDrive\\folder-operations\\providers.js' 'C:\\Users\\Mark\\OneDrive\\folder-operations\\test.json'",
// the above can be shortened with the use of a variable:
"command": "code -r '${workspaceFolder}\\providers.js' '${workspaceFolder}\\test.json'",
"problemMatcher": [],
"runOptions": {
"runOn": "folderOpen" // makes this task run on folder open
}
}
]
}
That goes into your tasks.json
file in the .vscode
folder at the root of your workspace.
It isn't the fastest operation as other vscode set-up occurs first, but it works.
For the Insiders Build, you would use
code-insiders -r ...
.
Upvotes: 1