(content: string, filepath: string[] = [])
| 151 | * @returns an object containing various information about the file created |
| 152 | */ |
| 153 | export const createFile = async (content: string, filepath: string[] = []) => { |
| 154 | const uri = getUriInWorkspace(...filepath); |
| 155 | const filenameComponents = path.parse(uri.toFsPath()); |
| 156 | await vscode.workspace.fs.writeFile( |
| 157 | toVsCodeUri(uri), |
| 158 | new TextEncoder().encode(content) |
| 159 | ); |
| 160 | return { uri, content, ...filenameComponents }; |
| 161 | }; |
| 162 | |
| 163 | export const renameFile = (from: URI, to: URI) => { |
| 164 | const edit = new vscode.WorkspaceEdit(); |
no test coverage detected