(foamUri: URI)
| 218 | |
| 219 | // Adapter to convert Foam URI to VS Code Uri |
| 220 | export function createVSCodeUri(foamUri: URI): Uri { |
| 221 | const uri: Uri = Object.defineProperties( |
| 222 | { |
| 223 | scheme: foamUri.scheme, |
| 224 | authority: foamUri.authority, |
| 225 | path: foamUri.path, |
| 226 | query: foamUri.query, |
| 227 | fragment: foamUri.fragment, |
| 228 | fsPath: foamUri.toFsPath(), |
| 229 | }, |
| 230 | { |
| 231 | with: { |
| 232 | value(change: Parameters<Uri['with']>[0]) { |
| 233 | return createVSCodeUri(foamUri.with(change)); |
| 234 | }, |
| 235 | enumerable: false, |
| 236 | }, |
| 237 | toString: { |
| 238 | value() { |
| 239 | return foamUri.toString(); |
| 240 | }, |
| 241 | enumerable: false, |
| 242 | }, |
| 243 | toJSON: { |
| 244 | value() { |
| 245 | return { |
| 246 | scheme: foamUri.scheme, |
| 247 | authority: foamUri.authority, |
| 248 | path: foamUri.path, |
| 249 | query: foamUri.query, |
| 250 | fragment: foamUri.fragment, |
| 251 | fsPath: foamUri.toFsPath(), |
| 252 | }; |
| 253 | }, |
| 254 | enumerable: false, |
| 255 | }, |
| 256 | } |
| 257 | ) as Uri; |
| 258 | return uri; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Convert VS Code Uri to Foam URI |
no test coverage detected