(filePath: string | vscode.Uri)
| 278 | * @returns Returns the file content as a string or null if the file does not exist |
| 279 | */ |
| 280 | export const tryReadFile = async (filePath: string | vscode.Uri) => { |
| 281 | const location = typeof filePath === "string" ? vscode.Uri.file(filePath) : filePath; |
| 282 | try { |
| 283 | const fileContent = await vscode.workspace.fs.readFile(location); |
| 284 | return fileContent.toString(); |
| 285 | } catch (e) { |
| 286 | return null; |
| 287 | } |
| 288 | }; |
| 289 | /** |
| 290 | * Gets the file content of the provided file path |
| 291 | * @param filePath File path to read |
no outgoing calls
no test coverage detected