我的要求其实很简单,我想写一个文件并在vscode中打开它。但我不能得到这个工作:VSCode扩展写入和打开文件
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);
});
我收到以下错误信息,而且不知道什么应该意味着:
无法打开C:%5CUsers%5Cmak%5C.sneditor %5Csoftpointdev1.service-now.com%5CRMCostPlanHelper.js。详细信息:没有使用uri'c:%5CUsers%5Cmak%5C.sneditor%5Csoftpointdev1.service-now.com%5CRMCostPlanHelper.js'的模型,也不是方案'c'的解析器。