* Performs a file system operation on the given URI using the provided delegate function. * * @template T The type of the result returned by the delegate function. * @param uri The URI on which the file system operation is to be performed. * @param delegate A function that performs the d
(
uri: vscode.Uri,
delegate: (uri: vscode.Uri) => T,
ignoreMissingProviders: boolean = true,
)
| 203 | * @throws Re-throws any error encountered during the operation, except for missing provider errors when `ignoreMissingProviders` is `true`. |
| 204 | */ |
| 205 | private async fsOperation<T>( |
| 206 | uri: vscode.Uri, |
| 207 | delegate: (uri: vscode.Uri) => T, |
| 208 | ignoreMissingProviders: boolean = true, |
| 209 | ): Promise<T | null> { |
| 210 | const scheme = uri.scheme; |
| 211 | if (ignoreMissingProviders && UNSUPPORTED_SCHEMES.has(scheme)) { |
| 212 | return null; |
| 213 | } |
| 214 | try { |
| 215 | return await delegate(uri); |
| 216 | } catch (err: any) { |
| 217 | if ( |
| 218 | ignoreMissingProviders && |
| 219 | //see https://github.com/microsoft/vscode/blob/c9c54f9e775e5f57d97bef796797b5bc670c8150/src/vs/workbench/api/common/extHostFileSystemConsumer.ts#L230 |
| 220 | (err.name === NO_FS_PROVIDER_ERROR || |
| 221 | err.message?.includes(NO_FS_PROVIDER_ERROR)) |
| 222 | ) { |
| 223 | UNSUPPORTED_SCHEMES.add(scheme); |
| 224 | console.log(`Ignoring missing provider error:`, err.message); |
| 225 | return null; |
| 226 | } |
| 227 | throw err; |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | showVirtualFile(name: string, contents: string) { |
| 232 | vscode.workspace |
no test coverage detected