My requirement is actually pretty simple, I want to write a file and open it in vscode. But I can't get this to work:
var content = rec[rt.fields[field]];
var filePath = path.join(vscode.workspace.rootPath, selected.label + '.' + field);
fs.writeFileSync(filePath, content, 'utf8');
var openPath = vscode.Uri.parse(filePath);
vscode.workspace.openTextDocument(openPath).then(doc => {
vscode.window.showTextDocument(doc);
});
I get the following error message and have no idea what that should mean:
cannot open c:%5CUsers%5Cmak%5C.sneditor%5Csoftpointdev1.service-now.com%5CRMCostPlanHelper.js. Detail: No model with uri 'c:%5CUsers%5Cmak%5C.sneditor%5Csoftpointdev1.service-now.com%5CRMCostPlanHelper.js' nor a resolver for the scheme 'c'.
I also encountered a similar problem. You can also solve your problem by doing the following:
var content = rec[rt.fields[field]];
var filePath = path.join(vscode.workspace.rootPath, selected.label + '.' + field);
fs.writeFileSync(filePath, content, 'utf8');
var openPath = vscode.Uri.parse("file:///" + filePath); //A request file path
vscode.workspace.openTextDocument(openPath).then(doc => {
vscode.window.showTextDocument(doc);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With