@theia/filesystem 1.77.0-next.0 → 1.77.0-next.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/breadcrumbs/filepath-breadcrumb.js +4 -8
- package/lib/browser/breadcrumbs/filepath-breadcrumb.js.map +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.d.ts +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.d.ts.map +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.js +18 -25
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.js.map +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.d.ts +5 -5
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.d.ts.map +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.js +27 -33
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.js.map +1 -1
- package/lib/browser/download/file-download-command-contribution.d.ts +1 -1
- package/lib/browser/download/file-download-command-contribution.d.ts.map +1 -1
- package/lib/browser/download/file-download-command-contribution.js +28 -33
- package/lib/browser/download/file-download-command-contribution.js.map +1 -1
- package/lib/browser/download/file-download-frontend-module.js +8 -10
- package/lib/browser/download/file-download-frontend-module.js.map +1 -1
- package/lib/browser/download/file-download-service.d.ts +1 -1
- package/lib/browser/download/file-download-service.d.ts.map +1 -1
- package/lib/browser/download/file-download-service.js +19 -25
- package/lib/browser/download/file-download-service.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-container.d.ts +1 -1
- package/lib/browser/file-dialog/file-dialog-container.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-container.js +25 -30
- package/lib/browser/file-dialog/file-dialog-container.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.d.ts +1 -1
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.js +13 -21
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-model.d.ts +2 -2
- package/lib/browser/file-dialog/file-dialog-model.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-model.js +20 -27
- package/lib/browser/file-dialog/file-dialog-model.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-module.js +21 -23
- package/lib/browser/file-dialog/file-dialog-module.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-service.d.ts +4 -4
- package/lib/browser/file-dialog/file-dialog-service.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-service.js +29 -38
- package/lib/browser/file-dialog/file-dialog-service.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.d.ts +3 -1
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.js +17 -22
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.spec.d.ts +2 -0
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.spec.d.ts.map +1 -0
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.spec.js +35 -0
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.spec.js.map +1 -0
- package/lib/browser/file-dialog/file-dialog-tree.d.ts +2 -2
- package/lib/browser/file-dialog/file-dialog-tree.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-tree.js +8 -11
- package/lib/browser/file-dialog/file-dialog-tree.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-widget.d.ts +2 -2
- package/lib/browser/file-dialog/file-dialog-widget.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-widget.js +18 -23
- package/lib/browser/file-dialog/file-dialog-widget.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog.d.ts +11 -6
- package/lib/browser/file-dialog/file-dialog.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog.js +109 -126
- package/lib/browser/file-dialog/file-dialog.js.map +1 -1
- package/lib/browser/file-dialog/index.d.ts +4 -4
- package/lib/browser/file-dialog/index.d.ts.map +1 -1
- package/lib/browser/file-dialog/index.js +4 -7
- package/lib/browser/file-dialog/index.js.map +1 -1
- package/lib/browser/file-resource.d.ts +2 -2
- package/lib/browser/file-resource.d.ts.map +1 -1
- package/lib/browser/file-resource.js +64 -71
- package/lib/browser/file-resource.js.map +1 -1
- package/lib/browser/file-resource.spec.js +39 -41
- package/lib/browser/file-resource.spec.js.map +1 -1
- package/lib/browser/file-selection.d.ts +1 -1
- package/lib/browser/file-selection.d.ts.map +1 -1
- package/lib/browser/file-selection.js +7 -10
- package/lib/browser/file-selection.js.map +1 -1
- package/lib/browser/file-service-activation.spec.d.ts +2 -0
- package/lib/browser/file-service-activation.spec.d.ts.map +1 -0
- package/lib/browser/file-service-activation.spec.js +79 -0
- package/lib/browser/file-service-activation.spec.js.map +1 -0
- package/lib/browser/file-service-copy.spec.d.ts +2 -0
- package/lib/browser/file-service-copy.spec.d.ts.map +1 -0
- package/lib/browser/file-service-copy.spec.js +193 -0
- package/lib/browser/file-service-copy.spec.js.map +1 -0
- package/lib/browser/file-service-watcher.spec.js +199 -201
- package/lib/browser/file-service-watcher.spec.js.map +1 -1
- package/lib/browser/file-service.d.ts +4 -4
- package/lib/browser/file-service.d.ts.map +1 -1
- package/lib/browser/file-service.js +179 -182
- package/lib/browser/file-service.js.map +1 -1
- package/lib/browser/file-tree/file-tree-container.js +12 -15
- package/lib/browser/file-tree/file-tree-container.js.map +1 -1
- package/lib/browser/file-tree/file-tree-decorator-adapter.js +23 -31
- package/lib/browser/file-tree/file-tree-decorator-adapter.js.map +1 -1
- package/lib/browser/file-tree/file-tree-decorator-adapter.spec.js +26 -28
- package/lib/browser/file-tree/file-tree-decorator-adapter.spec.js.map +1 -1
- package/lib/browser/file-tree/file-tree-label-provider.d.ts +1 -1
- package/lib/browser/file-tree/file-tree-label-provider.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree-label-provider.js +13 -18
- package/lib/browser/file-tree/file-tree-label-provider.js.map +1 -1
- package/lib/browser/file-tree/file-tree-model.d.ts +4 -4
- package/lib/browser/file-tree/file-tree-model.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree-model.js +42 -52
- package/lib/browser/file-tree/file-tree-model.js.map +1 -1
- package/lib/browser/file-tree/file-tree-widget.d.ts +3 -3
- package/lib/browser/file-tree/file-tree-widget.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree-widget.js +63 -71
- package/lib/browser/file-tree/file-tree-widget.js.map +1 -1
- package/lib/browser/file-tree/file-tree.d.ts +3 -3
- package/lib/browser/file-tree/file-tree.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree.js +26 -31
- package/lib/browser/file-tree/file-tree.js.map +1 -1
- package/lib/browser/file-tree/index.d.ts +6 -6
- package/lib/browser/file-tree/index.d.ts.map +1 -1
- package/lib/browser/file-tree/index.js +6 -9
- package/lib/browser/file-tree/index.js.map +1 -1
- package/lib/browser/filesystem-frontend-contribution.d.ts +6 -6
- package/lib/browser/filesystem-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/filesystem-frontend-contribution.js +75 -90
- package/lib/browser/filesystem-frontend-contribution.js.map +1 -1
- package/lib/browser/filesystem-frontend-module.js +47 -50
- package/lib/browser/filesystem-frontend-module.js.map +1 -1
- package/lib/browser/filesystem-saveable-service.d.ts +2 -2
- package/lib/browser/filesystem-saveable-service.d.ts.map +1 -1
- package/lib/browser/filesystem-saveable-service.js +35 -44
- package/lib/browser/filesystem-saveable-service.js.map +1 -1
- package/lib/browser/filesystem-watcher-error-handler.js +13 -18
- package/lib/browser/filesystem-watcher-error-handler.js.map +1 -1
- package/lib/browser/index.d.ts +4 -4
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +4 -7
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/location/index.d.ts +2 -2
- package/lib/browser/location/index.d.ts.map +1 -1
- package/lib/browser/location/index.js +2 -5
- package/lib/browser/location/index.js.map +1 -1
- package/lib/browser/location/location-renderer.d.ts +3 -3
- package/lib/browser/location/location-renderer.d.ts.map +1 -1
- package/lib/browser/location/location-renderer.js +42 -51
- package/lib/browser/location/location-renderer.js.map +1 -1
- package/lib/browser/location/location-renderer.spec.js +61 -63
- package/lib/browser/location/location-renderer.spec.js.map +1 -1
- package/lib/browser/location/location-service.js +1 -2
- package/lib/browser/location/location-service.js.map +1 -1
- package/lib/browser/remote-file-service-contribution.d.ts +2 -2
- package/lib/browser/remote-file-service-contribution.d.ts.map +1 -1
- package/lib/browser/remote-file-service-contribution.js +8 -12
- package/lib/browser/remote-file-service-contribution.js.map +1 -1
- package/lib/browser/upload/file-upload-service-impl.d.ts +3 -3
- package/lib/browser/upload/file-upload-service-impl.d.ts.map +1 -1
- package/lib/browser/upload/file-upload-service-impl.js +55 -64
- package/lib/browser/upload/file-upload-service-impl.js.map +1 -1
- package/lib/browser/vscode-file-service-contribution.d.ts +2 -2
- package/lib/browser/vscode-file-service-contribution.d.ts.map +1 -1
- package/lib/browser/vscode-file-service-contribution.js +23 -28
- package/lib/browser/vscode-file-service-contribution.js.map +1 -1
- package/lib/browser-only/browser-only-filesystem-frontend-module.js +21 -23
- package/lib/browser-only/browser-only-filesystem-frontend-module.js.map +1 -1
- package/lib/browser-only/browser-only-filesystem-provider-server.d.ts +1 -1
- package/lib/browser-only/browser-only-filesystem-provider-server.d.ts.map +1 -1
- package/lib/browser-only/browser-only-filesystem-provider-server.js +10 -13
- package/lib/browser-only/browser-only-filesystem-provider-server.js.map +1 -1
- package/lib/browser-only/download/file-download-command-contribution.d.ts +1 -1
- package/lib/browser-only/download/file-download-command-contribution.d.ts.map +1 -1
- package/lib/browser-only/download/file-download-command-contribution.js +14 -19
- package/lib/browser-only/download/file-download-command-contribution.js.map +1 -1
- package/lib/browser-only/download/file-download-frontend-module.js +8 -10
- package/lib/browser-only/download/file-download-frontend-module.js.map +1 -1
- package/lib/browser-only/download/file-download-service.d.ts +3 -3
- package/lib/browser-only/download/file-download-service.d.ts.map +1 -1
- package/lib/browser-only/download/file-download-service.js +26 -33
- package/lib/browser-only/download/file-download-service.js.map +1 -1
- package/lib/browser-only/file-search.d.ts.map +1 -1
- package/lib/browser-only/file-search.js +9 -14
- package/lib/browser-only/file-search.js.map +1 -1
- package/lib/browser-only/opfs-filesystem-initialization.d.ts +1 -1
- package/lib/browser-only/opfs-filesystem-initialization.d.ts.map +1 -1
- package/lib/browser-only/opfs-filesystem-initialization.js +6 -9
- package/lib/browser-only/opfs-filesystem-initialization.js.map +1 -1
- package/lib/browser-only/opfs-filesystem-provider.d.ts +2 -2
- package/lib/browser-only/opfs-filesystem-provider.d.ts.map +1 -1
- package/lib/browser-only/opfs-filesystem-provider.js +60 -68
- package/lib/browser-only/opfs-filesystem-provider.js.map +1 -1
- package/lib/browser-only/upload/file-upload-service-impl.d.ts +3 -3
- package/lib/browser-only/upload/file-upload-service-impl.d.ts.map +1 -1
- package/lib/browser-only/upload/file-upload-service-impl.js +51 -60
- package/lib/browser-only/upload/file-upload-service-impl.js.map +1 -1
- package/lib/common/delegating-file-system-provider.d.ts +1 -1
- package/lib/common/delegating-file-system-provider.d.ts.map +1 -1
- package/lib/common/delegating-file-system-provider.js +18 -22
- package/lib/common/delegating-file-system-provider.js.map +1 -1
- package/lib/common/download/file-download.js +5 -8
- package/lib/common/download/file-download.js.map +1 -1
- package/lib/common/file-upload.js +1 -4
- package/lib/common/file-upload.js.map +1 -1
- package/lib/common/files.js +38 -58
- package/lib/common/files.js.map +1 -1
- package/lib/common/files.spec.js +22 -24
- package/lib/common/files.spec.js.map +1 -1
- package/lib/common/filesystem-preferences.js +39 -44
- package/lib/common/filesystem-preferences.js.map +1 -1
- package/lib/common/filesystem-utils.d.ts +1 -1
- package/lib/common/filesystem-utils.d.ts.map +1 -1
- package/lib/common/filesystem-utils.js +2 -5
- package/lib/common/filesystem-utils.js.map +1 -1
- package/lib/common/filesystem-utils.spec.js +227 -229
- package/lib/common/filesystem-utils.spec.js.map +1 -1
- package/lib/common/filesystem-watcher-protocol.d.ts +5 -1
- package/lib/common/filesystem-watcher-protocol.d.ts.map +1 -1
- package/lib/common/filesystem-watcher-protocol.js +2 -5
- package/lib/common/filesystem-watcher-protocol.js.map +1 -1
- package/lib/common/filesystem.js +2 -5
- package/lib/common/filesystem.js.map +1 -1
- package/lib/common/index.d.ts +3 -3
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +3 -6
- package/lib/common/index.js.map +1 -1
- package/lib/common/io.d.ts +2 -2
- package/lib/common/io.d.ts.map +1 -1
- package/lib/common/io.js +10 -13
- package/lib/common/io.js.map +1 -1
- package/lib/common/remote-file-system-provider.d.ts +1 -1
- package/lib/common/remote-file-system-provider.d.ts.map +1 -1
- package/lib/common/remote-file-system-provider.js +81 -93
- package/lib/common/remote-file-system-provider.js.map +1 -1
- package/lib/common/upload/file-upload.js +1 -4
- package/lib/common/upload/file-upload.js.map +1 -1
- package/lib/electron-browser/file-dialog/electron-file-dialog-module.js +6 -8
- package/lib/electron-browser/file-dialog/electron-file-dialog-module.js.map +1 -1
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.d.ts +3 -3
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.d.ts.map +1 -1
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.js +20 -24
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.js.map +1 -1
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.spec.d.ts +2 -0
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.spec.d.ts.map +1 -0
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.spec.js +46 -0
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.spec.js.map +1 -0
- package/lib/electron-browser/preload.js +6 -9
- package/lib/electron-browser/preload.js.map +1 -1
- package/lib/electron-common/electron-api.js +2 -5
- package/lib/electron-common/electron-api.js.map +1 -1
- package/lib/electron-main/electron-api-main.js +15 -18
- package/lib/electron-main/electron-api-main.js.map +1 -1
- package/lib/electron-main/electron-main-module.js +6 -8
- package/lib/electron-main/electron-main-module.js.map +1 -1
- package/lib/node/disk-file-system-provider.d.ts +2 -2
- package/lib/node/disk-file-system-provider.d.ts.map +1 -1
- package/lib/node/disk-file-system-provider.js +116 -121
- package/lib/node/disk-file-system-provider.js.map +1 -1
- package/lib/node/disk-file-system-provider.spec.js +77 -54
- package/lib/node/disk-file-system-provider.spec.js.map +1 -1
- package/lib/node/download/directory-archiver.js +13 -16
- package/lib/node/download/directory-archiver.js.map +1 -1
- package/lib/node/download/directory-archiver.spec.js +20 -22
- package/lib/node/download/directory-archiver.spec.js.map +1 -1
- package/lib/node/download/file-download-backend-module.js +14 -16
- package/lib/node/download/file-download-backend-module.js.map +1 -1
- package/lib/node/download/file-download-cache.js +12 -16
- package/lib/node/download/file-download-cache.js.map +1 -1
- package/lib/node/download/file-download-endpoint.d.ts +1 -1
- package/lib/node/download/file-download-endpoint.d.ts.map +1 -1
- package/lib/node/download/file-download-endpoint.js +25 -31
- package/lib/node/download/file-download-endpoint.js.map +1 -1
- package/lib/node/download/file-download-handler.d.ts +2 -2
- package/lib/node/download/file-download-handler.d.ts.map +1 -1
- package/lib/node/download/file-download-handler.js +70 -77
- package/lib/node/download/file-download-handler.js.map +1 -1
- package/lib/node/download/test/mock-directory-archiver.d.ts +1 -1
- package/lib/node/download/test/mock-directory-archiver.d.ts.map +1 -1
- package/lib/node/download/test/mock-directory-archiver.js +2 -6
- package/lib/node/download/test/mock-directory-archiver.js.map +1 -1
- package/lib/node/file-change-collection.d.ts +1 -1
- package/lib/node/file-change-collection.d.ts.map +1 -1
- package/lib/node/file-change-collection.js +1 -5
- package/lib/node/file-change-collection.js.map +1 -1
- package/lib/node/file-change-collection.spec.js +5 -7
- package/lib/node/file-change-collection.spec.js.map +1 -1
- package/lib/node/filesystem-backend-module.d.ts +3 -3
- package/lib/node/filesystem-backend-module.d.ts.map +1 -1
- package/lib/node/filesystem-backend-module.js +57 -62
- package/lib/node/filesystem-backend-module.js.map +1 -1
- package/lib/node/filesystem-watcher-client.d.ts +2 -2
- package/lib/node/filesystem-watcher-client.d.ts.map +1 -1
- package/lib/node/filesystem-watcher-client.js +11 -16
- package/lib/node/filesystem-watcher-client.js.map +1 -1
- package/lib/node/filesystem-watcher-dispatcher.d.ts +1 -1
- package/lib/node/filesystem-watcher-dispatcher.d.ts.map +1 -1
- package/lib/node/filesystem-watcher-dispatcher.js +9 -13
- package/lib/node/filesystem-watcher-dispatcher.js.map +1 -1
- package/lib/node/filesystem-watcher-service-impl.d.ts +30 -0
- package/lib/node/filesystem-watcher-service-impl.d.ts.map +1 -0
- package/lib/node/filesystem-watcher-service-impl.js +88 -0
- package/lib/node/filesystem-watcher-service-impl.js.map +1 -0
- package/lib/node/filesystem-watcher-service-impl.spec.d.ts +2 -0
- package/lib/node/filesystem-watcher-service-impl.spec.d.ts.map +1 -0
- package/lib/node/filesystem-watcher-service-impl.spec.js +199 -0
- package/lib/node/filesystem-watcher-service-impl.spec.js.map +1 -0
- package/lib/node/filesystem-watcher.d.ts +93 -0
- package/lib/node/filesystem-watcher.d.ts.map +1 -0
- package/lib/node/filesystem-watcher.js +129 -0
- package/lib/node/filesystem-watcher.js.map +1 -0
- package/lib/node/nodejs-watcher/node-directory-watcher.d.ts +175 -0
- package/lib/node/nodejs-watcher/node-directory-watcher.d.ts.map +1 -0
- package/lib/node/nodejs-watcher/node-directory-watcher.js +574 -0
- package/lib/node/nodejs-watcher/node-directory-watcher.js.map +1 -0
- package/lib/node/nodejs-watcher/node-directory-watcher.spec.d.ts +2 -0
- package/lib/node/nodejs-watcher/node-directory-watcher.spec.d.ts.map +1 -0
- package/lib/node/nodejs-watcher/node-directory-watcher.spec.js +1281 -0
- package/lib/node/nodejs-watcher/node-directory-watcher.spec.js.map +1 -0
- package/lib/node/nodejs-watcher/watch-request-router.d.ts +63 -0
- package/lib/node/nodejs-watcher/watch-request-router.d.ts.map +1 -0
- package/lib/node/nodejs-watcher/watch-request-router.js +178 -0
- package/lib/node/nodejs-watcher/watch-request-router.js.map +1 -0
- package/lib/node/nodejs-watcher/watcher-host.d.ts +50 -0
- package/lib/node/nodejs-watcher/watcher-host.d.ts.map +1 -0
- package/lib/node/nodejs-watcher/watcher-host.js +94 -0
- package/lib/node/nodejs-watcher/watcher-host.js.map +1 -0
- package/lib/node/parcel-watcher/index.js +6 -8
- package/lib/node/parcel-watcher/index.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-filesystem-service.d.ts +14 -194
- package/lib/node/parcel-watcher/parcel-filesystem-service.d.ts.map +1 -1
- package/lib/node/parcel-watcher/parcel-filesystem-service.js +5 -426
- package/lib/node/parcel-watcher/parcel-filesystem-service.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-filesystem-watcher.spec.js +23 -25
- package/lib/node/parcel-watcher/parcel-filesystem-watcher.spec.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-options.js +1 -4
- package/lib/node/parcel-watcher/parcel-options.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-watcher-exclude.spec.js +12 -16
- package/lib/node/parcel-watcher/parcel-watcher-exclude.spec.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-watcher-retry.spec.js +11 -15
- package/lib/node/parcel-watcher/parcel-watcher-retry.spec.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-watcher.d.ts +165 -0
- package/lib/node/parcel-watcher/parcel-watcher.d.ts.map +1 -0
- package/lib/node/parcel-watcher/parcel-watcher.js +366 -0
- package/lib/node/parcel-watcher/parcel-watcher.js.map +1 -0
- package/lib/node/test/watcher-test-helper.d.ts +21 -0
- package/lib/node/test/watcher-test-helper.d.ts.map +1 -0
- package/lib/node/test/watcher-test-helper.js +51 -0
- package/lib/node/test/watcher-test-helper.js.map +1 -0
- package/lib/node/upload/node-file-upload-service.d.ts +1 -1
- package/lib/node/upload/node-file-upload-service.d.ts.map +1 -1
- package/lib/node/upload/node-file-upload-service.js +20 -25
- package/lib/node/upload/node-file-upload-service.js.map +1 -1
- package/lib/node/upload/node-file-upload-service.spec.js +21 -23
- package/lib/node/upload/node-file-upload-service.spec.js.map +1 -1
- package/package.json +21 -7
- package/src/browser/breadcrumbs/filepath-breadcrumb.ts +1 -1
- package/src/browser/breadcrumbs/filepath-breadcrumbs-container.ts +1 -1
- package/src/browser/breadcrumbs/filepath-breadcrumbs-contribution.ts +5 -5
- package/src/browser/download/file-download-command-contribution.ts +1 -1
- package/src/browser/download/file-download-frontend-module.ts +3 -3
- package/src/browser/download/file-download-service.ts +1 -2
- package/src/browser/file-dialog/file-dialog-container.ts +5 -5
- package/src/browser/file-dialog/file-dialog-hidden-files-renderer.tsx +1 -1
- package/src/browser/file-dialog/file-dialog-model.ts +2 -2
- package/src/browser/file-dialog/file-dialog-module.ts +5 -5
- package/src/browser/file-dialog/file-dialog-service.ts +4 -4
- package/src/browser/file-dialog/file-dialog-tree-filters-renderer.spec.ts +43 -0
- package/src/browser/file-dialog/file-dialog-tree-filters-renderer.tsx +4 -2
- package/src/browser/file-dialog/file-dialog-tree.ts +2 -2
- package/src/browser/file-dialog/file-dialog-widget.ts +2 -2
- package/src/browser/file-dialog/file-dialog.ts +17 -7
- package/src/browser/file-dialog/index.ts +4 -4
- package/src/browser/file-resource.spec.ts +3 -3
- package/src/browser/file-resource.ts +3 -3
- package/src/browser/file-selection.ts +1 -1
- package/src/browser/file-service-activation.spec.ts +93 -0
- package/src/browser/file-service-copy.spec.ts +226 -0
- package/src/browser/file-service-watcher.spec.ts +2 -2
- package/src/browser/file-service.ts +22 -11
- package/src/browser/file-tree/file-tree-container.ts +3 -3
- package/src/browser/file-tree/file-tree-decorator-adapter.spec.ts +1 -1
- package/src/browser/file-tree/file-tree-decorator-adapter.ts +1 -1
- package/src/browser/file-tree/file-tree-label-provider.ts +1 -1
- package/src/browser/file-tree/file-tree-model.ts +5 -5
- package/src/browser/file-tree/file-tree-widget.tsx +4 -4
- package/src/browser/file-tree/file-tree.ts +3 -3
- package/src/browser/file-tree/index.ts +6 -6
- package/src/browser/filesystem-frontend-contribution.ts +6 -6
- package/src/browser/filesystem-frontend-module.ts +14 -14
- package/src/browser/filesystem-saveable-service.ts +2 -2
- package/src/browser/index.ts +4 -4
- package/src/browser/location/index.ts +2 -2
- package/src/browser/location/location-renderer.spec.ts +3 -3
- package/src/browser/location/location-renderer.tsx +3 -3
- package/src/browser/remote-file-service-contribution.ts +2 -2
- package/src/browser/upload/file-upload-service-impl.ts +5 -5
- package/src/browser/vscode-file-service-contribution.ts +2 -2
- package/src/browser-only/browser-only-filesystem-frontend-module.ts +7 -7
- package/src/browser-only/browser-only-filesystem-provider-server.ts +1 -1
- package/src/browser-only/download/file-download-command-contribution.ts +2 -2
- package/src/browser-only/download/file-download-frontend-module.ts +3 -3
- package/src/browser-only/download/file-download-service.ts +3 -3
- package/src/browser-only/file-search.ts +2 -1
- package/src/browser-only/opfs-filesystem-initialization.ts +1 -1
- package/src/browser-only/opfs-filesystem-provider.ts +3 -3
- package/src/browser-only/upload/file-upload-service-impl.ts +4 -4
- package/src/common/delegating-file-system-provider.ts +1 -1
- package/src/common/files.spec.ts +1 -1
- package/src/common/filesystem-utils.spec.ts +2 -2
- package/src/common/filesystem-utils.ts +1 -1
- package/src/common/filesystem-watcher-protocol.ts +5 -1
- package/src/common/index.ts +3 -3
- package/src/common/io.ts +2 -2
- package/src/common/remote-file-system-provider.ts +1 -1
- package/src/electron-browser/file-dialog/electron-file-dialog-module.ts +2 -2
- package/src/electron-browser/file-dialog/electron-file-dialog-service.spec.ts +57 -0
- package/src/electron-browser/file-dialog/electron-file-dialog-service.ts +5 -5
- package/src/electron-browser/preload.ts +1 -1
- package/src/electron-main/electron-api-main.ts +1 -1
- package/src/electron-main/electron-main-module.ts +1 -1
- package/src/node/disk-file-system-provider.spec.ts +32 -3
- package/src/node/disk-file-system-provider.ts +12 -8
- package/src/node/download/directory-archiver.spec.ts +1 -1
- package/src/node/download/file-download-backend-module.ts +4 -4
- package/src/node/download/file-download-cache.ts +1 -1
- package/src/node/download/file-download-endpoint.ts +4 -3
- package/src/node/download/file-download-handler.ts +3 -4
- package/src/node/download/test/mock-directory-archiver.ts +1 -1
- package/src/node/file-change-collection.spec.ts +2 -2
- package/src/node/file-change-collection.ts +1 -1
- package/src/node/filesystem-backend-module.ts +15 -14
- package/src/node/filesystem-watcher-client.ts +2 -2
- package/src/node/filesystem-watcher-dispatcher.ts +1 -1
- package/src/node/filesystem-watcher-service-impl.spec.ts +272 -0
- package/src/node/filesystem-watcher-service-impl.ts +109 -0
- package/src/node/filesystem-watcher.ts +197 -0
- package/src/node/nodejs-watcher/node-directory-watcher.spec.ts +1594 -0
- package/src/node/nodejs-watcher/node-directory-watcher.ts +664 -0
- package/src/node/nodejs-watcher/watch-request-router.ts +224 -0
- package/src/node/nodejs-watcher/watcher-host.ts +126 -0
- package/src/node/parcel-watcher/index.ts +3 -3
- package/src/node/parcel-watcher/parcel-filesystem-service.ts +14 -500
- package/src/node/parcel-watcher/parcel-filesystem-watcher.spec.ts +5 -5
- package/src/node/parcel-watcher/parcel-watcher-exclude.spec.ts +7 -11
- package/src/node/parcel-watcher/parcel-watcher-retry.spec.ts +6 -8
- package/src/node/parcel-watcher/parcel-watcher.ts +433 -0
- package/src/node/test/watcher-test-helper.ts +58 -0
- package/src/node/upload/node-file-upload-service.spec.ts +1 -1
- package/src/node/upload/node-file-upload-service.ts +6 -6
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// *****************************************************************************
|
|
3
2
|
// Copyright (C) 2020 TypeFox and others.
|
|
4
3
|
//
|
|
@@ -23,38 +22,36 @@
|
|
|
23
22
|
// and https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts
|
|
24
23
|
// and https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/workbench/services/workingCopy/common/workingCopyFileService.ts
|
|
25
24
|
// and https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/workbench/services/workingCopy/common/workingCopyFileOperationParticipant.ts
|
|
26
|
-
|
|
27
|
-
exports.FileService = exports.TextFileOperationError = exports.FileServiceContribution = void 0;
|
|
28
|
-
const tslib_1 = require("tslib");
|
|
25
|
+
import { __decorate } from "tslib";
|
|
29
26
|
/* eslint-disable max-len */
|
|
27
|
+
/* eslint-disable @stylistic/brace-style, @stylistic/semi-spacing */
|
|
30
28
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
31
29
|
/* eslint-disable no-null/no-null */
|
|
32
|
-
/* eslint-disable @typescript-eslint/tslint/config */
|
|
33
30
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
class TextFileOperationError extends
|
|
31
|
+
import { injectable, inject, named, postConstruct } from '@theia/core/shared/inversify';
|
|
32
|
+
import { timeout, Deferred } from '@theia/core/lib/common/promise-util';
|
|
33
|
+
import { CancellationToken, CancellationTokenSource } from '@theia/core/lib/common/cancellation';
|
|
34
|
+
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
35
|
+
import { WaitUntilEvent, Emitter, AsyncEmitter } from '@theia/core/lib/common/event';
|
|
36
|
+
import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
|
|
37
|
+
import { TernarySearchTree } from '@theia/core/lib/common/ternary-search-tree';
|
|
38
|
+
import { ensureFileSystemProviderError, etag, ETAG_DISABLED, FileChangesEvent, FileOperationError, FileOperationEvent, FileSystemProviderErrorCode, FileType, hasFileFolderCopyCapability, hasOpenReadWriteCloseCapability, hasReadWriteCapability, FileStat, toFileOperationResult, toFileSystemProviderErrorCode, hasAccessCapability, hasUpdateCapability, hasFileReadStreamCapability, ReadOnlyMessageFileSystemProvider } from '../common/files.js';
|
|
39
|
+
import { BinaryBuffer, BinaryBufferReadable, BinaryBufferReadableStream, BinaryBufferReadableBufferedStream, BinaryBufferWriteableStream } from '@theia/core/lib/common/buffer';
|
|
40
|
+
import { isReadableStream, isReadableBufferedStream, transform, consumeStream, peekStream, peekReadable } from '@theia/core/lib/common/stream';
|
|
41
|
+
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
|
|
42
|
+
import { FileSystemPreferences } from '../common/filesystem-preferences.js';
|
|
43
|
+
import { ProgressService } from '@theia/core/lib/common/progress-service';
|
|
44
|
+
import { DelegatingFileSystemProvider } from '../common/delegating-file-system-provider.js';
|
|
45
|
+
import { EncodingRegistry } from '@theia/core/lib/browser/encoding-registry';
|
|
46
|
+
import { UTF8, UTF8_with_bom } from '@theia/core/lib/common/encodings';
|
|
47
|
+
import { EncodingService } from '@theia/core/lib/common/encoding-service';
|
|
48
|
+
import { Minimatch } from 'minimatch';
|
|
49
|
+
import { readFileIntoStream } from '../common/io.js';
|
|
50
|
+
import { FileSystemWatcherErrorHandler } from './filesystem-watcher-error-handler.js';
|
|
51
|
+
import { FileSystemUtils } from '../common/filesystem-utils.js';
|
|
52
|
+
import { nls, ILogger } from '@theia/core';
|
|
53
|
+
export const FileServiceContribution = Symbol('FileServiceContribution');
|
|
54
|
+
export class TextFileOperationError extends FileOperationError {
|
|
58
55
|
constructor(message, textFileOperationResult, options) {
|
|
59
56
|
super(message, 11 /* FileOperationResult.FILE_OTHER_ERROR */);
|
|
60
57
|
this.textFileOperationResult = textFileOperationResult;
|
|
@@ -62,7 +59,6 @@ class TextFileOperationError extends files_1.FileOperationError {
|
|
|
62
59
|
Object.setPrototypeOf(this, TextFileOperationError.prototype);
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
|
-
exports.TextFileOperationError = TextFileOperationError;
|
|
66
62
|
/**
|
|
67
63
|
* The {@link FileService} is the common facade responsible for all interactions with file systems.
|
|
68
64
|
* It manages all registered {@link FileSystemProvider}s and
|
|
@@ -74,19 +70,19 @@ let FileService = class FileService {
|
|
|
74
70
|
this.BUFFER_SIZE = 64 * 1024;
|
|
75
71
|
// #region Events
|
|
76
72
|
this.correlationIds = 0;
|
|
77
|
-
this.onWillRunUserOperationEmitter = new
|
|
73
|
+
this.onWillRunUserOperationEmitter = new AsyncEmitter();
|
|
78
74
|
/**
|
|
79
75
|
* An event that is emitted when file operation is being performed.
|
|
80
76
|
* This event is triggered by user gestures.
|
|
81
77
|
*/
|
|
82
78
|
this.onWillRunUserOperation = this.onWillRunUserOperationEmitter.event;
|
|
83
|
-
this.onDidFailUserOperationEmitter = new
|
|
79
|
+
this.onDidFailUserOperationEmitter = new AsyncEmitter();
|
|
84
80
|
/**
|
|
85
81
|
* An event that is emitted when file operation is failed.
|
|
86
82
|
* This event is triggered by user gestures.
|
|
87
83
|
*/
|
|
88
84
|
this.onDidFailUserOperation = this.onDidFailUserOperationEmitter.event;
|
|
89
|
-
this.onDidRunUserOperationEmitter = new
|
|
85
|
+
this.onDidRunUserOperationEmitter = new AsyncEmitter();
|
|
90
86
|
/**
|
|
91
87
|
* An event that is emitted when file operation is finished.
|
|
92
88
|
* This event is triggered by user gestures.
|
|
@@ -94,21 +90,21 @@ let FileService = class FileService {
|
|
|
94
90
|
this.onDidRunUserOperation = this.onDidRunUserOperationEmitter.event;
|
|
95
91
|
// #endregion
|
|
96
92
|
// #region File System Provider
|
|
97
|
-
this.onDidChangeFileSystemProviderRegistrationsEmitter = new
|
|
93
|
+
this.onDidChangeFileSystemProviderRegistrationsEmitter = new Emitter();
|
|
98
94
|
this.onDidChangeFileSystemProviderRegistrations = this.onDidChangeFileSystemProviderRegistrationsEmitter.event;
|
|
99
|
-
this.onWillActivateFileSystemProviderEmitter = new
|
|
95
|
+
this.onWillActivateFileSystemProviderEmitter = new Emitter();
|
|
100
96
|
/**
|
|
101
97
|
* See `FileServiceContribution.registerProviders`.
|
|
102
98
|
*/
|
|
103
99
|
this.onWillActivateFileSystemProvider = this.onWillActivateFileSystemProviderEmitter.event;
|
|
104
|
-
this.onDidChangeFileSystemProviderCapabilitiesEmitter = new
|
|
100
|
+
this.onDidChangeFileSystemProviderCapabilitiesEmitter = new Emitter();
|
|
105
101
|
this.onDidChangeFileSystemProviderCapabilities = this.onDidChangeFileSystemProviderCapabilitiesEmitter.event;
|
|
106
|
-
this.onDidChangeFileSystemProviderReadOnlyMessageEmitter = new
|
|
102
|
+
this.onDidChangeFileSystemProviderReadOnlyMessageEmitter = new Emitter();
|
|
107
103
|
this.onDidChangeFileSystemProviderReadOnlyMessage = this.onDidChangeFileSystemProviderReadOnlyMessageEmitter.event;
|
|
108
104
|
this.providers = new Map();
|
|
109
105
|
this.activations = new Map();
|
|
110
106
|
// #endregion
|
|
111
|
-
this.onDidRunOperationEmitter = new
|
|
107
|
+
this.onDidRunOperationEmitter = new Emitter();
|
|
112
108
|
/**
|
|
113
109
|
* An event that is emitted when operation is finished.
|
|
114
110
|
* This event is triggered by user gestures and programmatically.
|
|
@@ -116,7 +112,7 @@ let FileService = class FileService {
|
|
|
116
112
|
this.onDidRunOperation = this.onDidRunOperationEmitter.event;
|
|
117
113
|
// #endregion
|
|
118
114
|
// #region File Watching
|
|
119
|
-
this.onDidFilesChangeEmitter = new
|
|
115
|
+
this.onDidFilesChangeEmitter = new Emitter();
|
|
120
116
|
this.activeWatchers = new Map();
|
|
121
117
|
this.recursiveWatcherIndexes = new Map();
|
|
122
118
|
// #endregion
|
|
@@ -144,14 +140,14 @@ let FileService = class FileService {
|
|
|
144
140
|
}
|
|
145
141
|
this.providers.set(scheme, provider);
|
|
146
142
|
this.onDidChangeFileSystemProviderRegistrationsEmitter.fire({ added: true, scheme, provider });
|
|
147
|
-
const providerDisposables = new
|
|
148
|
-
providerDisposables.push(provider.onDidChangeFile(changes => this.onDidFilesChangeEmitter.fire(new
|
|
143
|
+
const providerDisposables = new DisposableCollection();
|
|
144
|
+
providerDisposables.push(provider.onDidChangeFile(changes => this.onDidFilesChangeEmitter.fire(new FileChangesEvent(changes))));
|
|
149
145
|
providerDisposables.push(provider.onFileWatchError(() => this.handleFileWatchError()));
|
|
150
146
|
providerDisposables.push(provider.onDidChangeCapabilities(() => this.onDidChangeFileSystemProviderCapabilitiesEmitter.fire({ provider, scheme })));
|
|
151
|
-
if (
|
|
147
|
+
if (ReadOnlyMessageFileSystemProvider.is(provider)) {
|
|
152
148
|
providerDisposables.push(provider.onDidChangeReadOnlyMessage(message => this.onDidChangeFileSystemProviderReadOnlyMessageEmitter.fire({ provider, scheme, message })));
|
|
153
149
|
}
|
|
154
|
-
return
|
|
150
|
+
return Disposable.create(() => {
|
|
155
151
|
this.onDidChangeFileSystemProviderRegistrationsEmitter.fire({ added: false, scheme, provider });
|
|
156
152
|
this.providers.delete(scheme);
|
|
157
153
|
this.recursiveWatcherIndexes.delete(provider);
|
|
@@ -171,9 +167,18 @@ let FileService = class FileService {
|
|
|
171
167
|
}
|
|
172
168
|
let activation = this.activations.get(scheme);
|
|
173
169
|
if (!activation) {
|
|
174
|
-
const deferredActivation = new
|
|
170
|
+
const deferredActivation = new Deferred();
|
|
175
171
|
this.activations.set(scheme, activation = deferredActivation.promise);
|
|
176
|
-
|
|
172
|
+
// Resolve the activation as soon as a provider is registered for the scheme. Otherwise a
|
|
173
|
+
// slow or dangling `onWillActivateFileSystemProvider` listener whose `waitUntil` promise
|
|
174
|
+
// never settles would wedge this activation (and everything awaiting it) forever. See #17506.
|
|
175
|
+
const registration = this.onDidChangeFileSystemProviderRegistrations(event => {
|
|
176
|
+
if (event.added && event.scheme === scheme && event.provider) {
|
|
177
|
+
deferredActivation.resolve(event.provider);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
deferredActivation.promise.then(() => registration.dispose(), () => registration.dispose());
|
|
181
|
+
WaitUntilEvent.fire(this.onWillActivateFileSystemProviderEmitter, { scheme }).then(() => {
|
|
177
182
|
provider = this.providers.get(scheme);
|
|
178
183
|
if (!provider) {
|
|
179
184
|
const error = new Error();
|
|
@@ -202,7 +207,7 @@ let FileService = class FileService {
|
|
|
202
207
|
}
|
|
203
208
|
getReadOnlyMessage(resource) {
|
|
204
209
|
const provider = this.providers.get(resource.scheme);
|
|
205
|
-
if (
|
|
210
|
+
if (ReadOnlyMessageFileSystemProvider.is(provider)) {
|
|
206
211
|
return provider.readOnlyMessage;
|
|
207
212
|
}
|
|
208
213
|
return undefined;
|
|
@@ -230,20 +235,20 @@ let FileService = class FileService {
|
|
|
230
235
|
async withProvider(resource) {
|
|
231
236
|
// Assert path is absolute
|
|
232
237
|
if (!resource.path.isAbsolute) {
|
|
233
|
-
throw new
|
|
238
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to resolve filesystem provider with relative file path '{0}'", this.resourceForError(resource)), 8 /* FileOperationResult.FILE_INVALID_PATH */);
|
|
234
239
|
}
|
|
235
240
|
return this.activateProvider(resource.scheme);
|
|
236
241
|
}
|
|
237
242
|
async withReadProvider(resource) {
|
|
238
243
|
const provider = await this.withProvider(resource);
|
|
239
|
-
if (
|
|
244
|
+
if (hasOpenReadWriteCloseCapability(provider) || hasReadWriteCapability(provider)) {
|
|
240
245
|
return provider;
|
|
241
246
|
}
|
|
242
247
|
throw new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`);
|
|
243
248
|
}
|
|
244
249
|
async withWriteProvider(resource) {
|
|
245
250
|
const provider = await this.withProvider(resource);
|
|
246
|
-
if (
|
|
251
|
+
if (hasOpenReadWriteCloseCapability(provider) || hasReadWriteCapability(provider)) {
|
|
247
252
|
return provider;
|
|
248
253
|
}
|
|
249
254
|
throw new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`);
|
|
@@ -254,11 +259,11 @@ let FileService = class FileService {
|
|
|
254
259
|
}
|
|
255
260
|
catch (error) {
|
|
256
261
|
// Specially handle file not found case as file operation result
|
|
257
|
-
if (
|
|
258
|
-
throw new
|
|
262
|
+
if (toFileSystemProviderErrorCode(error) === FileSystemProviderErrorCode.FileNotFound) {
|
|
263
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to resolve nonexistent file '{0}'", this.resourceForError(resource)), 1 /* FileOperationResult.FILE_NOT_FOUND */);
|
|
259
264
|
}
|
|
260
265
|
// Bubble up any other error as is
|
|
261
|
-
throw
|
|
266
|
+
throw ensureFileSystemProviderError(error);
|
|
262
267
|
}
|
|
263
268
|
}
|
|
264
269
|
async doResolveFile(resource, options) {
|
|
@@ -271,7 +276,7 @@ let FileService = class FileService {
|
|
|
271
276
|
return this.toFileStat(provider, resource, stat, undefined, !!resolveMetadata, (stat, siblings) => {
|
|
272
277
|
// lazy trie to check for recursive resolving
|
|
273
278
|
if (!trie) {
|
|
274
|
-
trie =
|
|
279
|
+
trie = TernarySearchTree.forUris(!!(provider.capabilities & 1024 /* FileSystemProviderCapabilities.PathCaseSensitive */));
|
|
275
280
|
trie.set(resource, true);
|
|
276
281
|
if (Array.isArray(resolveTo) && resolveTo.length) {
|
|
277
282
|
resolveTo.forEach(uri => trie.set(uri, true));
|
|
@@ -289,7 +294,7 @@ let FileService = class FileService {
|
|
|
289
294
|
});
|
|
290
295
|
}
|
|
291
296
|
async toFileStat(provider, resource, stat, siblings, resolveMetadata, recurse) {
|
|
292
|
-
const fileStat =
|
|
297
|
+
const fileStat = FileStat.fromStat(resource, stat);
|
|
293
298
|
// check to recurse for directories
|
|
294
299
|
if (fileStat.isDirectory && recurse(fileStat, siblings)) {
|
|
295
300
|
try {
|
|
@@ -354,7 +359,7 @@ let FileService = class FileService {
|
|
|
354
359
|
*/
|
|
355
360
|
async access(resource, mode) {
|
|
356
361
|
const provider = await this.withProvider(resource);
|
|
357
|
-
if (!
|
|
362
|
+
if (!hasAccessCapability(provider)) {
|
|
358
363
|
return false;
|
|
359
364
|
}
|
|
360
365
|
try {
|
|
@@ -380,7 +385,7 @@ let FileService = class FileService {
|
|
|
380
385
|
*/
|
|
381
386
|
async fsPath(resource) {
|
|
382
387
|
const provider = await this.withProvider(resource);
|
|
383
|
-
if (!
|
|
388
|
+
if (!hasAccessCapability(provider)) {
|
|
384
389
|
return resource.path.toString();
|
|
385
390
|
}
|
|
386
391
|
return provider.fsPath(resource);
|
|
@@ -421,15 +426,15 @@ let FileService = class FileService {
|
|
|
421
426
|
});
|
|
422
427
|
return {
|
|
423
428
|
...bufferStream,
|
|
424
|
-
encoding: decoder.detected.encoding ||
|
|
425
|
-
value: await
|
|
429
|
+
encoding: decoder.detected.encoding || UTF8,
|
|
430
|
+
value: await consumeStream(decoder.stream, strings => strings.join(''))
|
|
426
431
|
};
|
|
427
432
|
}
|
|
428
433
|
async readStream(resource, options) {
|
|
429
434
|
const [bufferStream, decoder] = await this.doRead(resource, options);
|
|
430
435
|
return {
|
|
431
436
|
...bufferStream,
|
|
432
|
-
encoding: decoder.detected.encoding ||
|
|
437
|
+
encoding: decoder.detected.encoding || UTF8,
|
|
433
438
|
value: decoder.stream
|
|
434
439
|
};
|
|
435
440
|
}
|
|
@@ -441,7 +446,7 @@ let FileService = class FileService {
|
|
|
441
446
|
const content = await this.readFile(resource, options);
|
|
442
447
|
bufferStream = {
|
|
443
448
|
...content,
|
|
444
|
-
value:
|
|
449
|
+
value: BinaryBufferReadableStream.fromBuffer(content.value)
|
|
445
450
|
};
|
|
446
451
|
}
|
|
447
452
|
else {
|
|
@@ -453,7 +458,7 @@ let FileService = class FileService {
|
|
|
453
458
|
});
|
|
454
459
|
// validate binary
|
|
455
460
|
if (options?.acceptTextOnly && decoder.detected.seemsBinary) {
|
|
456
|
-
throw new TextFileOperationError(
|
|
461
|
+
throw new TextFileOperationError(nls.localizeByDefault('File seems to be binary and cannot be opened as text'), 0 /* TextFileOperationResult.FILE_IS_BINARY */, options);
|
|
457
462
|
}
|
|
458
463
|
return [bufferStream, decoder];
|
|
459
464
|
}
|
|
@@ -472,7 +477,7 @@ let FileService = class FileService {
|
|
|
472
477
|
const provider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(resource), resource);
|
|
473
478
|
try {
|
|
474
479
|
await this.validateWriteFile(provider, resource, options);
|
|
475
|
-
if (
|
|
480
|
+
if (hasUpdateCapability(provider)) {
|
|
476
481
|
const encoding = await this.getEncodingForResource(resource, options ? options.encoding : undefined);
|
|
477
482
|
;
|
|
478
483
|
const stat = await provider.updateFile(resource, changes, {
|
|
@@ -480,7 +485,7 @@ let FileService = class FileService {
|
|
|
480
485
|
writeEncoding: encoding,
|
|
481
486
|
overwriteEncoding: options.overwriteEncoding || false
|
|
482
487
|
});
|
|
483
|
-
return Object.assign(
|
|
488
|
+
return Object.assign(FileStat.fromStat(resource, stat), { encoding: stat.encoding });
|
|
484
489
|
}
|
|
485
490
|
else {
|
|
486
491
|
throw new Error('incremental file update is not supported');
|
|
@@ -492,15 +497,15 @@ let FileService = class FileService {
|
|
|
492
497
|
}
|
|
493
498
|
// #endregion
|
|
494
499
|
// #region File Reading/Writing
|
|
495
|
-
async createFile(resource, bufferOrReadableOrStream =
|
|
500
|
+
async createFile(resource, bufferOrReadableOrStream = BinaryBuffer.fromString(''), options) {
|
|
496
501
|
// validate overwrite
|
|
497
502
|
if (!options?.overwrite && await this.exists(resource)) {
|
|
498
|
-
throw new
|
|
503
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to create file '{0}' that already exists when overwrite flag is not set", this.resourceForError(resource)), 3 /* FileOperationResult.FILE_MODIFIED_SINCE */, options);
|
|
499
504
|
}
|
|
500
505
|
// do write into file (this will create it too)
|
|
501
506
|
const fileStat = await this.writeFile(resource, bufferOrReadableOrStream);
|
|
502
507
|
// events
|
|
503
|
-
this.onDidRunOperationEmitter.fire(new
|
|
508
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(resource, 0 /* FileOperation.CREATE */, fileStat));
|
|
504
509
|
return fileStat;
|
|
505
510
|
}
|
|
506
511
|
async writeFile(resource, bufferOrReadableOrStream, options) {
|
|
@@ -517,30 +522,30 @@ let FileService = class FileService {
|
|
|
517
522
|
// unbuffered to reduce the overhead. If the Readable has more data to provide
|
|
518
523
|
// we continue to write buffered.
|
|
519
524
|
let bufferOrReadableOrStreamOrBufferedStream;
|
|
520
|
-
if (
|
|
521
|
-
if (
|
|
522
|
-
const bufferedStream = await
|
|
525
|
+
if (hasReadWriteCapability(provider) && !(bufferOrReadableOrStream instanceof BinaryBuffer)) {
|
|
526
|
+
if (isReadableStream(bufferOrReadableOrStream)) {
|
|
527
|
+
const bufferedStream = await peekStream(bufferOrReadableOrStream, 3);
|
|
523
528
|
if (bufferedStream.ended) {
|
|
524
|
-
bufferOrReadableOrStreamOrBufferedStream =
|
|
529
|
+
bufferOrReadableOrStreamOrBufferedStream = BinaryBuffer.concat(bufferedStream.buffer);
|
|
525
530
|
}
|
|
526
531
|
else {
|
|
527
532
|
bufferOrReadableOrStreamOrBufferedStream = bufferedStream;
|
|
528
533
|
}
|
|
529
534
|
}
|
|
530
535
|
else {
|
|
531
|
-
bufferOrReadableOrStreamOrBufferedStream =
|
|
536
|
+
bufferOrReadableOrStreamOrBufferedStream = peekReadable(bufferOrReadableOrStream, data => BinaryBuffer.concat(data), 3);
|
|
532
537
|
}
|
|
533
538
|
}
|
|
534
539
|
else {
|
|
535
540
|
bufferOrReadableOrStreamOrBufferedStream = bufferOrReadableOrStream;
|
|
536
541
|
}
|
|
537
542
|
// write file: unbuffered (only if data to write is a buffer, or the provider has no buffered write capability)
|
|
538
|
-
if (!
|
|
543
|
+
if (!hasOpenReadWriteCloseCapability(provider) || (hasReadWriteCapability(provider) && bufferOrReadableOrStreamOrBufferedStream instanceof BinaryBuffer)) {
|
|
539
544
|
await this.doWriteUnbuffered(provider, resource, bufferOrReadableOrStreamOrBufferedStream);
|
|
540
545
|
}
|
|
541
546
|
// write file: buffered
|
|
542
547
|
else {
|
|
543
|
-
await this.doWriteBuffered(provider, resource, bufferOrReadableOrStreamOrBufferedStream instanceof
|
|
548
|
+
await this.doWriteBuffered(provider, resource, bufferOrReadableOrStreamOrBufferedStream instanceof BinaryBuffer ? BinaryBufferReadable.fromBuffer(bufferOrReadableOrStreamOrBufferedStream) : bufferOrReadableOrStreamOrBufferedStream);
|
|
544
549
|
}
|
|
545
550
|
}
|
|
546
551
|
catch (error) {
|
|
@@ -557,11 +562,11 @@ let FileService = class FileService {
|
|
|
557
562
|
return undefined; // file might not exist
|
|
558
563
|
}
|
|
559
564
|
// file cannot be directory
|
|
560
|
-
if ((stat.type &
|
|
561
|
-
throw new
|
|
565
|
+
if ((stat.type & FileType.Directory) !== 0) {
|
|
566
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to write file '{0}' that is actually a directory", this.resourceForError(resource)), 0 /* FileOperationResult.FILE_IS_DIRECTORY */, options);
|
|
562
567
|
}
|
|
563
568
|
if (this.modifiedSince(stat, options)) {
|
|
564
|
-
throw new
|
|
569
|
+
throw new FileOperationError(nls.localizeByDefault('File Modified Since'), 3 /* FileOperationResult.FILE_MODIFIED_SINCE */, options);
|
|
565
570
|
}
|
|
566
571
|
return stat;
|
|
567
572
|
}
|
|
@@ -580,9 +585,9 @@ let FileService = class FileService {
|
|
|
580
585
|
* the file content for comparison which would be much slower to compute.
|
|
581
586
|
*/
|
|
582
587
|
modifiedSince(stat, options) {
|
|
583
|
-
return !!options && typeof options.mtime === 'number' && typeof options.etag === 'string' && options.etag !==
|
|
588
|
+
return !!options && typeof options.mtime === 'number' && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED &&
|
|
584
589
|
typeof stat.mtime === 'number' && typeof stat.size === 'number' &&
|
|
585
|
-
options.mtime < stat.mtime && options.etag !==
|
|
590
|
+
options.mtime < stat.mtime && options.etag !== etag({ mtime: options.mtime /* not using stat.mtime for a reason, see above */, size: stat.size });
|
|
586
591
|
}
|
|
587
592
|
shouldReadUnbuffered(options) {
|
|
588
593
|
// optimization: since we know that the caller does not
|
|
@@ -604,7 +609,7 @@ let FileService = class FileService {
|
|
|
604
609
|
});
|
|
605
610
|
return {
|
|
606
611
|
...stream,
|
|
607
|
-
value: await
|
|
612
|
+
value: await BinaryBufferReadableStream.toBuffer(stream.value)
|
|
608
613
|
};
|
|
609
614
|
}
|
|
610
615
|
async readFileStream(resource, options) {
|
|
@@ -616,7 +621,7 @@ let FileService = class FileService {
|
|
|
616
621
|
// when any error occurs. this allows us to resolve
|
|
617
622
|
// the content of the file while resolving metadata
|
|
618
623
|
// but still cancel the operation in certain cases.
|
|
619
|
-
const cancellableSource = new
|
|
624
|
+
const cancellableSource = new CancellationTokenSource();
|
|
620
625
|
// validate read operation
|
|
621
626
|
const statPromise = this.validateReadFile(resource, options).then(stat => stat, error => {
|
|
622
627
|
cancellableSource.cancel();
|
|
@@ -627,16 +632,16 @@ let FileService = class FileService {
|
|
|
627
632
|
// due to the likelyhood of hitting a NOT_MODIFIED_SINCE result.
|
|
628
633
|
// otherwise, we let it run in parallel to the file reading for
|
|
629
634
|
// optimal startup performance.
|
|
630
|
-
if (options && typeof options.etag === 'string' && options.etag !==
|
|
635
|
+
if (options && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED) {
|
|
631
636
|
await statPromise;
|
|
632
637
|
}
|
|
633
638
|
let fileStreamPromise;
|
|
634
639
|
// read unbuffered (only if either preferred, or the provider has no buffered read capability)
|
|
635
|
-
if (!(
|
|
640
|
+
if (!(hasOpenReadWriteCloseCapability(provider) || hasFileReadStreamCapability(provider)) || (hasReadWriteCapability(provider) && options?.preferUnbuffered)) {
|
|
636
641
|
fileStreamPromise = this.readFileUnbuffered(provider, resource, options);
|
|
637
642
|
}
|
|
638
643
|
// read streamed (always prefer over primitive buffered read)
|
|
639
|
-
else if (
|
|
644
|
+
else if (hasFileReadStreamCapability(provider)) {
|
|
640
645
|
fileStreamPromise = Promise.resolve(this.readFileStreamed(provider, resource, cancellableSource.token, options));
|
|
641
646
|
}
|
|
642
647
|
// read buffered
|
|
@@ -655,14 +660,14 @@ let FileService = class FileService {
|
|
|
655
660
|
}
|
|
656
661
|
readFileStreamed(provider, resource, token, options = Object.create(null)) {
|
|
657
662
|
const fileStream = provider.readFileStream(resource, options, token);
|
|
658
|
-
return
|
|
659
|
-
data: data => data instanceof
|
|
663
|
+
return transform(fileStream, {
|
|
664
|
+
data: data => data instanceof BinaryBuffer ? data : BinaryBuffer.wrap(data),
|
|
660
665
|
error: error => this.asFileOperationError("Unable to read file '{0}' ({1})", resource, error, options)
|
|
661
|
-
}, data =>
|
|
666
|
+
}, data => BinaryBuffer.concat(data));
|
|
662
667
|
}
|
|
663
668
|
readFileBuffered(provider, resource, token, options = Object.create(null)) {
|
|
664
|
-
const stream =
|
|
665
|
-
|
|
669
|
+
const stream = BinaryBufferWriteableStream.create();
|
|
670
|
+
readFileIntoStream(provider, resource, stream, data => data, {
|
|
666
671
|
...options,
|
|
667
672
|
bufferSize: this.BUFFER_SIZE,
|
|
668
673
|
errorTransformer: error => this.asFileOperationError("Unable to read file '{0}' ({1})", resource, error, options)
|
|
@@ -673,7 +678,7 @@ let FileService = class FileService {
|
|
|
673
678
|
throw this.asFileOperationError(message, resource, error, options);
|
|
674
679
|
}
|
|
675
680
|
asFileOperationError(message, resource, error, options) {
|
|
676
|
-
const fileOperationError = new
|
|
681
|
+
const fileOperationError = new FileOperationError(nls.localizeByDefault(message, this.resourceForError(resource), ensureFileSystemProviderError(error).toString()), toFileOperationResult(error), options);
|
|
677
682
|
fileOperationError.stack = `${fileOperationError.stack}\nCaused by: ${error.stack}`;
|
|
678
683
|
return fileOperationError;
|
|
679
684
|
}
|
|
@@ -689,17 +694,17 @@ let FileService = class FileService {
|
|
|
689
694
|
}
|
|
690
695
|
// Throw if file is too large to load
|
|
691
696
|
this.validateReadFileLimits(resource, buffer.byteLength, options);
|
|
692
|
-
return
|
|
697
|
+
return BinaryBufferReadableStream.fromBuffer(BinaryBuffer.wrap(buffer));
|
|
693
698
|
}
|
|
694
699
|
async validateReadFile(resource, options) {
|
|
695
700
|
const stat = await this.resolve(resource, { resolveMetadata: true });
|
|
696
701
|
// Throw if resource is a directory
|
|
697
702
|
if (stat.isDirectory) {
|
|
698
|
-
throw new
|
|
703
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to read file '{0}' that is actually a directory", this.resourceForError(resource)), 0 /* FileOperationResult.FILE_IS_DIRECTORY */, options);
|
|
699
704
|
}
|
|
700
705
|
// Throw if file not modified since (unless disabled)
|
|
701
|
-
if (options && typeof options.etag === 'string' && options.etag !==
|
|
702
|
-
throw new
|
|
706
|
+
if (options && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {
|
|
707
|
+
throw new FileOperationError(nls.localizeByDefault('File not modified since'), 2 /* FileOperationResult.FILE_NOT_MODIFIED_SINCE */, options);
|
|
703
708
|
}
|
|
704
709
|
// Throw if file is too large to load
|
|
705
710
|
this.validateReadFileLimits(resource, stat.size, options);
|
|
@@ -715,7 +720,7 @@ let FileService = class FileService {
|
|
|
715
720
|
tooLargeErrorResult = 7 /* FileOperationResult.FILE_TOO_LARGE */;
|
|
716
721
|
}
|
|
717
722
|
if (typeof tooLargeErrorResult === 'number') {
|
|
718
|
-
throw new
|
|
723
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to read file '{0}' that is too large to open", this.resourceForError(resource)), tooLargeErrorResult);
|
|
719
724
|
}
|
|
720
725
|
}
|
|
721
726
|
}
|
|
@@ -746,7 +751,7 @@ let FileService = class FileService {
|
|
|
746
751
|
const mode = await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'move', !!overwrite);
|
|
747
752
|
// resolve and send events
|
|
748
753
|
const fileStat = await this.resolve(target, { resolveMetadata: true });
|
|
749
|
-
this.onDidRunOperationEmitter.fire(new
|
|
754
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(source, mode === 'move' ? 2 /* FileOperation.MOVE */ : 3 /* FileOperation.COPY */, fileStat));
|
|
750
755
|
return fileStat;
|
|
751
756
|
}
|
|
752
757
|
async copy(source, target, options) {
|
|
@@ -774,7 +779,7 @@ let FileService = class FileService {
|
|
|
774
779
|
const mode = await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'copy', !!overwrite);
|
|
775
780
|
// resolve and send events
|
|
776
781
|
const fileStat = await this.resolve(target, { resolveMetadata: true });
|
|
777
|
-
this.onDidRunOperationEmitter.fire(new
|
|
782
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(source, mode === 'copy' ? 3 /* FileOperation.COPY */ : 2 /* FileOperation.MOVE */, fileStat));
|
|
778
783
|
return fileStat;
|
|
779
784
|
}
|
|
780
785
|
async doMoveCopy(sourceProvider, source, targetProvider, target, mode, overwrite) {
|
|
@@ -787,7 +792,7 @@ let FileService = class FileService {
|
|
|
787
792
|
if (exists && !overwrite) {
|
|
788
793
|
const parent = await this.resolve(target.parent);
|
|
789
794
|
const targetFileStat = await this.resolve(target);
|
|
790
|
-
target =
|
|
795
|
+
target = FileSystemUtils.generateUniqueResourceURI(parent, target, targetFileStat.isDirectory, isSameResourceWithDifferentPathCase ? 'copy' : undefined);
|
|
791
796
|
}
|
|
792
797
|
// delete as needed (unless target is same resource with different path case)
|
|
793
798
|
if (exists && !isSameResourceWithDifferentPathCase && overwrite) {
|
|
@@ -798,7 +803,7 @@ let FileService = class FileService {
|
|
|
798
803
|
// copy source => target
|
|
799
804
|
if (mode === 'copy') {
|
|
800
805
|
// same provider with fast copy: leverage copy() functionality
|
|
801
|
-
if (sourceProvider === targetProvider &&
|
|
806
|
+
if (sourceProvider === targetProvider && hasFileFolderCopyCapability(sourceProvider)) {
|
|
802
807
|
await sourceProvider.copy(source, target, { overwrite });
|
|
803
808
|
}
|
|
804
809
|
// when copying via buffer/unbuffered, we have to manually
|
|
@@ -831,19 +836,19 @@ let FileService = class FileService {
|
|
|
831
836
|
}
|
|
832
837
|
async doCopyFile(sourceProvider, source, targetProvider, target) {
|
|
833
838
|
// copy: source (buffered) => target (buffered)
|
|
834
|
-
if (
|
|
839
|
+
if (hasOpenReadWriteCloseCapability(sourceProvider) && hasOpenReadWriteCloseCapability(targetProvider)) {
|
|
835
840
|
return this.doPipeBuffered(sourceProvider, source, targetProvider, target);
|
|
836
841
|
}
|
|
837
842
|
// copy: source (buffered) => target (unbuffered)
|
|
838
|
-
if (
|
|
843
|
+
if (hasOpenReadWriteCloseCapability(sourceProvider) && hasReadWriteCapability(targetProvider)) {
|
|
839
844
|
return this.doPipeBufferedToUnbuffered(sourceProvider, source, targetProvider, target);
|
|
840
845
|
}
|
|
841
846
|
// copy: source (unbuffered) => target (buffered)
|
|
842
|
-
if (
|
|
847
|
+
if (hasReadWriteCapability(sourceProvider) && hasOpenReadWriteCloseCapability(targetProvider)) {
|
|
843
848
|
return this.doPipeUnbufferedToBuffered(sourceProvider, source, targetProvider, target);
|
|
844
849
|
}
|
|
845
850
|
// copy: source (unbuffered) => target (unbuffered)
|
|
846
|
-
if (
|
|
851
|
+
if (hasReadWriteCapability(sourceProvider) && hasReadWriteCapability(targetProvider)) {
|
|
847
852
|
return this.doPipeUnbuffered(sourceProvider, source, targetProvider, target);
|
|
848
853
|
}
|
|
849
854
|
}
|
|
@@ -872,10 +877,10 @@ let FileService = class FileService {
|
|
|
872
877
|
isSameResourceWithDifferentPathCase = source.toString().toLowerCase() === target.toString().toLowerCase();
|
|
873
878
|
}
|
|
874
879
|
if (isSameResourceWithDifferentPathCase && mode === 'copy') {
|
|
875
|
-
throw new Error(
|
|
880
|
+
throw new Error(nls.localizeByDefault("Unable to move/copy when source '{0}' is parent of target '{1}'.", this.resourceForError(source), this.resourceForError(target)));
|
|
876
881
|
}
|
|
877
|
-
if (!isSameResourceWithDifferentPathCase &&
|
|
878
|
-
throw new Error(
|
|
882
|
+
if (!isSameResourceWithDifferentPathCase && source.isEqualOrParent(target, isPathCaseSensitive)) {
|
|
883
|
+
throw new Error(nls.localizeByDefault("Unable to move/copy when source '{0}' is parent of target '{1}'.", this.resourceForError(source), this.resourceForError(target)));
|
|
879
884
|
}
|
|
880
885
|
}
|
|
881
886
|
// Extra checks if target exists and this is not a rename
|
|
@@ -885,8 +890,8 @@ let FileService = class FileService {
|
|
|
885
890
|
// it as it would delete the source as well. In this case we have to throw
|
|
886
891
|
if (sourceProvider === targetProvider) {
|
|
887
892
|
const isPathCaseSensitive = !!(sourceProvider.capabilities & 1024 /* FileSystemProviderCapabilities.PathCaseSensitive */);
|
|
888
|
-
if (
|
|
889
|
-
throw new Error(
|
|
893
|
+
if (target.isEqualOrParent(source, isPathCaseSensitive)) {
|
|
894
|
+
throw new Error(nls.localizeByDefault("Unable to move/copy '{0}' into '{1}' since a file would replace the folder it is contained in.", this.resourceForError(source), this.resourceForError(target)));
|
|
890
895
|
}
|
|
891
896
|
}
|
|
892
897
|
}
|
|
@@ -903,7 +908,7 @@ let FileService = class FileService {
|
|
|
903
908
|
this.onDidRunUserOperationEmitter.fire({ correlationId: this.correlationIds++, operation: 0 /* FileOperation.CREATE */, target: resource });
|
|
904
909
|
}
|
|
905
910
|
else {
|
|
906
|
-
this.onDidRunOperationEmitter.fire(new
|
|
911
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(resource, 0 /* FileOperation.CREATE */, fileStat));
|
|
907
912
|
}
|
|
908
913
|
return fileStat;
|
|
909
914
|
}
|
|
@@ -913,14 +918,14 @@ let FileService = class FileService {
|
|
|
913
918
|
while (!directory.path.isRoot) {
|
|
914
919
|
try {
|
|
915
920
|
const stat = await provider.stat(directory);
|
|
916
|
-
if ((stat.type &
|
|
917
|
-
throw new Error(
|
|
921
|
+
if ((stat.type & FileType.Directory) === 0) {
|
|
922
|
+
throw new Error(nls.localizeByDefault("Unable to create folder '{0}' that already exists but is not a directory", this.resourceForError(directory)));
|
|
918
923
|
}
|
|
919
924
|
break; // we have hit a directory that exists -> good
|
|
920
925
|
}
|
|
921
926
|
catch (error) {
|
|
922
927
|
// Bubble up any other error that is not file not found
|
|
923
|
-
if (
|
|
928
|
+
if (toFileSystemProviderErrorCode(error) !== FileSystemProviderErrorCode.FileNotFound) {
|
|
924
929
|
throw error;
|
|
925
930
|
}
|
|
926
931
|
// Upon error, remember directories that need to be created
|
|
@@ -936,7 +941,7 @@ let FileService = class FileService {
|
|
|
936
941
|
await provider.mkdir(directory);
|
|
937
942
|
}
|
|
938
943
|
catch (error) {
|
|
939
|
-
if (
|
|
944
|
+
if (toFileSystemProviderErrorCode(error) !== FileSystemProviderErrorCode.FileExists) {
|
|
940
945
|
// For mkdirp() we tolerate that the mkdir() call fails
|
|
941
946
|
// in case the folder already exists. This follows node.js
|
|
942
947
|
// own implementation of fs.mkdir({ recursive: true }) and
|
|
@@ -971,25 +976,25 @@ let FileService = class FileService {
|
|
|
971
976
|
// Validate trash support
|
|
972
977
|
const useTrash = !!options?.useTrash;
|
|
973
978
|
if (useTrash && !(provider.capabilities & 4096 /* FileSystemProviderCapabilities.Trash */)) {
|
|
974
|
-
throw new Error(
|
|
979
|
+
throw new Error(nls.localizeByDefault("Unable to delete file '{0}' via trash because provider does not support it.", this.resourceForError(resource)));
|
|
975
980
|
}
|
|
976
981
|
// Validate delete
|
|
977
982
|
const exists = await this.exists(resource);
|
|
978
983
|
if (!exists) {
|
|
979
|
-
throw new
|
|
984
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to delete nonexistent file '{0}'", this.resourceForError(resource)), 1 /* FileOperationResult.FILE_NOT_FOUND */);
|
|
980
985
|
}
|
|
981
986
|
// Validate recursive
|
|
982
987
|
const recursive = !!options?.recursive;
|
|
983
988
|
if (!recursive && exists) {
|
|
984
989
|
const stat = await this.resolve(resource);
|
|
985
990
|
if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
|
|
986
|
-
throw new Error(
|
|
991
|
+
throw new Error(nls.localizeByDefault("Unable to delete non-empty folder '{0}'.", this.resourceForError(resource)));
|
|
987
992
|
}
|
|
988
993
|
}
|
|
989
994
|
// Delete through provider
|
|
990
995
|
await provider.delete(resource, { recursive, useTrash });
|
|
991
996
|
// Events
|
|
992
|
-
this.onDidRunOperationEmitter.fire(new
|
|
997
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(resource, 1 /* FileOperation.DELETE */));
|
|
993
998
|
}
|
|
994
999
|
/**
|
|
995
1000
|
* An event that is emitted when files are changed on the disk.
|
|
@@ -1003,7 +1008,7 @@ let FileService = class FileService {
|
|
|
1003
1008
|
excludes: this.resolveWatcherExcludes(resource, options.excludes)
|
|
1004
1009
|
};
|
|
1005
1010
|
let watchDisposed = false;
|
|
1006
|
-
let watchDisposable =
|
|
1011
|
+
let watchDisposable = Disposable.create(() => watchDisposed = true);
|
|
1007
1012
|
// Watch and wire in disposable which is async but
|
|
1008
1013
|
// check if we got disposed meanwhile and forward
|
|
1009
1014
|
this.doWatch(resource, resolvedOptions).then(disposable => {
|
|
@@ -1014,7 +1019,7 @@ let FileService = class FileService {
|
|
|
1014
1019
|
watchDisposable = disposable;
|
|
1015
1020
|
}
|
|
1016
1021
|
}, error => this.logger.error(error));
|
|
1017
|
-
return
|
|
1022
|
+
return Disposable.create(() => watchDisposable.dispose());
|
|
1018
1023
|
}
|
|
1019
1024
|
/**
|
|
1020
1025
|
* Resolve the effective exclude globs for a watcher: the caller-supplied `excludes`, the
|
|
@@ -1079,7 +1084,7 @@ let FileService = class FileService {
|
|
|
1079
1084
|
realWatcher,
|
|
1080
1085
|
subsumingParent: undefined,
|
|
1081
1086
|
subsumedChildren: new Set(),
|
|
1082
|
-
compiledExcludes: options.excludes.map(pattern => new
|
|
1087
|
+
compiledExcludes: options.excludes.map(pattern => new Minimatch(pattern, { dot: true })),
|
|
1083
1088
|
};
|
|
1084
1089
|
return recursiveEntry;
|
|
1085
1090
|
}
|
|
@@ -1091,7 +1096,7 @@ let FileService = class FileService {
|
|
|
1091
1096
|
};
|
|
1092
1097
|
}
|
|
1093
1098
|
createWatcherDisposable(key, entry) {
|
|
1094
|
-
return
|
|
1099
|
+
return Disposable.create(() => {
|
|
1095
1100
|
entry.count--;
|
|
1096
1101
|
if (entry.count === 0) {
|
|
1097
1102
|
this.disposeWatcherEntry(key, entry);
|
|
@@ -1283,7 +1288,7 @@ let FileService = class FileService {
|
|
|
1283
1288
|
let tree = this.recursiveWatcherIndexes.get(provider);
|
|
1284
1289
|
if (!tree) {
|
|
1285
1290
|
const caseSensitive = !!(provider.capabilities & 1024 /* FileSystemProviderCapabilities.PathCaseSensitive */);
|
|
1286
|
-
tree =
|
|
1291
|
+
tree = TernarySearchTree.forUris(caseSensitive);
|
|
1287
1292
|
this.recursiveWatcherIndexes.set(provider, tree);
|
|
1288
1293
|
}
|
|
1289
1294
|
return tree;
|
|
@@ -1325,7 +1330,7 @@ let FileService = class FileService {
|
|
|
1325
1330
|
const handle = await provider.open(resource, { create: true });
|
|
1326
1331
|
// write into handle until all bytes from buffer have been written
|
|
1327
1332
|
try {
|
|
1328
|
-
if (
|
|
1333
|
+
if (isReadableStream(readableOrStreamOrBufferedStream) || isReadableBufferedStream(readableOrStreamOrBufferedStream)) {
|
|
1329
1334
|
await this.doWriteStreamBufferedQueued(provider, handle, readableOrStreamOrBufferedStream);
|
|
1330
1335
|
}
|
|
1331
1336
|
else {
|
|
@@ -1333,7 +1338,7 @@ let FileService = class FileService {
|
|
|
1333
1338
|
}
|
|
1334
1339
|
}
|
|
1335
1340
|
catch (error) {
|
|
1336
|
-
throw
|
|
1341
|
+
throw ensureFileSystemProviderError(error);
|
|
1337
1342
|
}
|
|
1338
1343
|
finally {
|
|
1339
1344
|
// close handle always
|
|
@@ -1346,9 +1351,9 @@ let FileService = class FileService {
|
|
|
1346
1351
|
let stream;
|
|
1347
1352
|
// Buffered stream: consume the buffer first by writing
|
|
1348
1353
|
// it to the target before reading from the stream.
|
|
1349
|
-
if (
|
|
1354
|
+
if (isReadableBufferedStream(streamOrBufferedStream)) {
|
|
1350
1355
|
if (streamOrBufferedStream.buffer.length > 0) {
|
|
1351
|
-
const chunk =
|
|
1356
|
+
const chunk = BinaryBuffer.concat(streamOrBufferedStream.buffer);
|
|
1352
1357
|
await this.doWriteBuffer(provider, handle, chunk, chunk.byteLength, posInFile, 0);
|
|
1353
1358
|
posInFile += chunk.byteLength;
|
|
1354
1359
|
}
|
|
@@ -1403,17 +1408,17 @@ let FileService = class FileService {
|
|
|
1403
1408
|
}
|
|
1404
1409
|
async doWriteUnbufferedQueued(provider, resource, bufferOrReadableOrStreamOrBufferedStream) {
|
|
1405
1410
|
let buffer;
|
|
1406
|
-
if (bufferOrReadableOrStreamOrBufferedStream instanceof
|
|
1411
|
+
if (bufferOrReadableOrStreamOrBufferedStream instanceof BinaryBuffer) {
|
|
1407
1412
|
buffer = bufferOrReadableOrStreamOrBufferedStream;
|
|
1408
1413
|
}
|
|
1409
|
-
else if (
|
|
1410
|
-
buffer = await
|
|
1414
|
+
else if (isReadableStream(bufferOrReadableOrStreamOrBufferedStream)) {
|
|
1415
|
+
buffer = await BinaryBufferReadableStream.toBuffer(bufferOrReadableOrStreamOrBufferedStream);
|
|
1411
1416
|
}
|
|
1412
|
-
else if (
|
|
1413
|
-
buffer = await
|
|
1417
|
+
else if (isReadableBufferedStream(bufferOrReadableOrStreamOrBufferedStream)) {
|
|
1418
|
+
buffer = await BinaryBufferReadableBufferedStream.toBuffer(bufferOrReadableOrStreamOrBufferedStream);
|
|
1414
1419
|
}
|
|
1415
1420
|
else {
|
|
1416
|
-
buffer =
|
|
1421
|
+
buffer = BinaryBufferReadable.toBuffer(bufferOrReadableOrStreamOrBufferedStream);
|
|
1417
1422
|
}
|
|
1418
1423
|
return provider.writeFile(resource, buffer.buffer, { create: true, overwrite: true });
|
|
1419
1424
|
}
|
|
@@ -1427,7 +1432,7 @@ let FileService = class FileService {
|
|
|
1427
1432
|
// Open handles
|
|
1428
1433
|
sourceHandle = await sourceProvider.open(source, { create: false });
|
|
1429
1434
|
targetHandle = await targetProvider.open(target, { create: true });
|
|
1430
|
-
const buffer =
|
|
1435
|
+
const buffer = BinaryBuffer.alloc(this.BUFFER_SIZE);
|
|
1431
1436
|
let posInFile = 0;
|
|
1432
1437
|
let posInBuffer = 0;
|
|
1433
1438
|
let bytesRead = 0;
|
|
@@ -1447,7 +1452,7 @@ let FileService = class FileService {
|
|
|
1447
1452
|
} while (bytesRead > 0);
|
|
1448
1453
|
}
|
|
1449
1454
|
catch (error) {
|
|
1450
|
-
throw
|
|
1455
|
+
throw ensureFileSystemProviderError(error);
|
|
1451
1456
|
}
|
|
1452
1457
|
finally {
|
|
1453
1458
|
await Promise.all([
|
|
@@ -1471,10 +1476,10 @@ let FileService = class FileService {
|
|
|
1471
1476
|
// Read entire buffer from source and write buffered
|
|
1472
1477
|
try {
|
|
1473
1478
|
const buffer = await sourceProvider.readFile(source);
|
|
1474
|
-
await this.doWriteBuffer(targetProvider, targetHandle,
|
|
1479
|
+
await this.doWriteBuffer(targetProvider, targetHandle, BinaryBuffer.wrap(buffer), buffer.byteLength, 0, 0);
|
|
1475
1480
|
}
|
|
1476
1481
|
catch (error) {
|
|
1477
|
-
throw
|
|
1482
|
+
throw ensureFileSystemProviderError(error);
|
|
1478
1483
|
}
|
|
1479
1484
|
finally {
|
|
1480
1485
|
await targetProvider.close(targetHandle);
|
|
@@ -1482,13 +1487,13 @@ let FileService = class FileService {
|
|
|
1482
1487
|
}
|
|
1483
1488
|
async doPipeBufferedToUnbuffered(sourceProvider, source, targetProvider, target) {
|
|
1484
1489
|
// Read buffer via stream buffered
|
|
1485
|
-
const buffer = await
|
|
1490
|
+
const buffer = await BinaryBufferReadableStream.toBuffer(this.readFileBuffered(sourceProvider, source, CancellationToken.None));
|
|
1486
1491
|
// Write buffer into target at once
|
|
1487
1492
|
await this.doWriteUnbuffered(targetProvider, target, buffer);
|
|
1488
1493
|
}
|
|
1489
1494
|
throwIfFileSystemIsReadonly(provider, resource) {
|
|
1490
1495
|
if (provider.capabilities & 2048 /* FileSystemProviderCapabilities.Readonly */) {
|
|
1491
|
-
throw new
|
|
1496
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to modify read-only file '{0}'", this.resourceForError(resource)), 6 /* FileOperationResult.FILE_PERMISSION_DENIED */);
|
|
1492
1497
|
}
|
|
1493
1498
|
return provider;
|
|
1494
1499
|
}
|
|
@@ -1497,7 +1502,7 @@ let FileService = class FileService {
|
|
|
1497
1502
|
}
|
|
1498
1503
|
addFileOperationParticipant(participant) {
|
|
1499
1504
|
this.participants.push(participant);
|
|
1500
|
-
return
|
|
1505
|
+
return Disposable.create(() => {
|
|
1501
1506
|
const index = this.participants.indexOf(participant);
|
|
1502
1507
|
if (index > -1) {
|
|
1503
1508
|
this.participants.splice(index, 1);
|
|
@@ -1509,7 +1514,7 @@ let FileService = class FileService {
|
|
|
1509
1514
|
if (participantsTimeout <= 0 || this.participants.length === 0) {
|
|
1510
1515
|
return;
|
|
1511
1516
|
}
|
|
1512
|
-
const cancellationTokenSource = new
|
|
1517
|
+
const cancellationTokenSource = new CancellationTokenSource();
|
|
1513
1518
|
return this.progressService.withProgress(this.progressLabel(operation), 'notification', async () => {
|
|
1514
1519
|
for (const participant of this.participants) {
|
|
1515
1520
|
if (cancellationTokenSource.token.isCancellationRequested) {
|
|
@@ -1519,7 +1524,7 @@ let FileService = class FileService {
|
|
|
1519
1524
|
const promise = participant.participate(target, source, operation, participantsTimeout, cancellationTokenSource.token);
|
|
1520
1525
|
await Promise.race([
|
|
1521
1526
|
promise,
|
|
1522
|
-
|
|
1527
|
+
timeout(participantsTimeout, cancellationTokenSource.token).then(() => cancellationTokenSource.dispose(), () => { })
|
|
1523
1528
|
]);
|
|
1524
1529
|
}
|
|
1525
1530
|
catch (err) {
|
|
@@ -1533,13 +1538,13 @@ let FileService = class FileService {
|
|
|
1533
1538
|
progressLabel(operation) {
|
|
1534
1539
|
switch (operation) {
|
|
1535
1540
|
case 0 /* FileOperation.CREATE */:
|
|
1536
|
-
return
|
|
1541
|
+
return nls.localizeByDefault("Running 'File Create' participants...");
|
|
1537
1542
|
case 2 /* FileOperation.MOVE */:
|
|
1538
|
-
return
|
|
1543
|
+
return nls.localizeByDefault("Running 'File Rename' participants...");
|
|
1539
1544
|
case 3 /* FileOperation.COPY */:
|
|
1540
|
-
return
|
|
1545
|
+
return nls.localizeByDefault("Running 'File Copy' participants...");
|
|
1541
1546
|
case 1 /* FileOperation.DELETE */:
|
|
1542
|
-
return
|
|
1547
|
+
return nls.localizeByDefault("Running 'File Delete' participants...");
|
|
1543
1548
|
}
|
|
1544
1549
|
}
|
|
1545
1550
|
// #endregion
|
|
@@ -1549,7 +1554,7 @@ let FileService = class FileService {
|
|
|
1549
1554
|
return this.encodingService.toResourceEncoding(encoding, {
|
|
1550
1555
|
overwriteEncoding: options?.overwriteEncoding,
|
|
1551
1556
|
read: async (length) => {
|
|
1552
|
-
const buffer = await
|
|
1557
|
+
const buffer = await BinaryBufferReadableStream.toBuffer((await this.readFileStream(resource, { length })).value);
|
|
1553
1558
|
return buffer.buffer;
|
|
1554
1559
|
}
|
|
1555
1560
|
});
|
|
@@ -1558,8 +1563,8 @@ let FileService = class FileService {
|
|
|
1558
1563
|
let preferredEncoding;
|
|
1559
1564
|
// Encoding passed in as option
|
|
1560
1565
|
if (options?.encoding) {
|
|
1561
|
-
if (detectedEncoding ===
|
|
1562
|
-
preferredEncoding =
|
|
1566
|
+
if (detectedEncoding === UTF8_with_bom && options.encoding === UTF8) {
|
|
1567
|
+
preferredEncoding = UTF8_with_bom; // indicate the file has BOM if we are to resolve with UTF 8
|
|
1563
1568
|
}
|
|
1564
1569
|
else {
|
|
1565
1570
|
preferredEncoding = options.encoding; // give passed in encoding highest priority
|
|
@@ -1568,6 +1573,9 @@ let FileService = class FileService {
|
|
|
1568
1573
|
else if (detectedEncoding) {
|
|
1569
1574
|
preferredEncoding = detectedEncoding;
|
|
1570
1575
|
}
|
|
1576
|
+
else if (this.preferences.get('files.encoding', undefined, resource.toString()) === UTF8_with_bom) {
|
|
1577
|
+
preferredEncoding = UTF8; // if we did not detect UTF 8 BOM before, this can only be UTF 8 then
|
|
1578
|
+
}
|
|
1571
1579
|
return this.getEncodingForResource(resource, preferredEncoding);
|
|
1572
1580
|
}
|
|
1573
1581
|
async getEncodingForResource(resource, preferredEncoding) {
|
|
@@ -1582,7 +1590,7 @@ let FileService = class FileService {
|
|
|
1582
1590
|
*/
|
|
1583
1591
|
async toUnderlyingResource(resource) {
|
|
1584
1592
|
let provider = await this.withProvider(resource);
|
|
1585
|
-
while (provider instanceof
|
|
1593
|
+
while (provider instanceof DelegatingFileSystemProvider) {
|
|
1586
1594
|
resource = provider.toUnderlyingResource(resource);
|
|
1587
1595
|
provider = await this.withProvider(resource);
|
|
1588
1596
|
}
|
|
@@ -1593,48 +1601,37 @@ let FileService = class FileService {
|
|
|
1593
1601
|
this.watcherErrorHandler.handleError();
|
|
1594
1602
|
}
|
|
1595
1603
|
};
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
(0, inversify_1.inject)(label_provider_1.LabelProvider),
|
|
1599
|
-
tslib_1.__metadata("design:type", label_provider_1.LabelProvider)
|
|
1604
|
+
__decorate([
|
|
1605
|
+
inject(LabelProvider)
|
|
1600
1606
|
], FileService.prototype, "labelProvider", void 0);
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
tslib_1.__metadata("design:type", Object)
|
|
1607
|
+
__decorate([
|
|
1608
|
+
inject(FileSystemPreferences)
|
|
1604
1609
|
], FileService.prototype, "preferences", void 0);
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
tslib_1.__metadata("design:type", progress_service_1.ProgressService)
|
|
1610
|
+
__decorate([
|
|
1611
|
+
inject(ProgressService)
|
|
1608
1612
|
], FileService.prototype, "progressService", void 0);
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
tslib_1.__metadata("design:type", encoding_registry_1.EncodingRegistry)
|
|
1613
|
+
__decorate([
|
|
1614
|
+
inject(EncodingRegistry)
|
|
1612
1615
|
], FileService.prototype, "encodingRegistry", void 0);
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
tslib_1.__metadata("design:type", encoding_service_1.EncodingService)
|
|
1616
|
+
__decorate([
|
|
1617
|
+
inject(EncodingService)
|
|
1616
1618
|
], FileService.prototype, "encodingService", void 0);
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
tslib_1.__metadata("design:type", Object)
|
|
1619
|
+
__decorate([
|
|
1620
|
+
inject(ContributionProvider),
|
|
1621
|
+
named(FileServiceContribution)
|
|
1621
1622
|
], FileService.prototype, "contributions", void 0);
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
tslib_1.__metadata("design:type", filesystem_watcher_error_handler_1.FileSystemWatcherErrorHandler)
|
|
1623
|
+
__decorate([
|
|
1624
|
+
inject(FileSystemWatcherErrorHandler)
|
|
1625
1625
|
], FileService.prototype, "watcherErrorHandler", void 0);
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
tslib_1.__metadata("design:type", Object)
|
|
1626
|
+
__decorate([
|
|
1627
|
+
inject(ILogger),
|
|
1628
|
+
named('filesystem:FileService')
|
|
1630
1629
|
], FileService.prototype, "logger", void 0);
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
tslib_1.__metadata("design:type", Function),
|
|
1634
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
1635
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
1630
|
+
__decorate([
|
|
1631
|
+
postConstruct()
|
|
1636
1632
|
], FileService.prototype, "init", null);
|
|
1637
|
-
|
|
1638
|
-
|
|
1633
|
+
FileService = __decorate([
|
|
1634
|
+
injectable()
|
|
1639
1635
|
], FileService);
|
|
1636
|
+
export { FileService };
|
|
1640
1637
|
//# sourceMappingURL=file-service.js.map
|