Skip to content

Finalise FileSystemProvider api #47475

@jrieken

Description

@jrieken

For April we want to finalise the FileSystemProvider API. This will be mostly simplifying things and fixing how we read/write data. This issue is a bit of a kitchen sink

  • support simple readFile and writeFile since that's easy to implement and since it covers most use-cases
  • support reading/writing in chunks to enable large file support in remote file systems. This will also include open/close calls and thereby make the server stateful -> Support reading/writing chunks in remote fs #41985
  • simplify delete, e.g. don't differentiate between file/folder on the API level
  • rename FileSystemProvider#move to FileSystemProvider#rename
  • add optional function FileSystemProvider#copy
  • polish enum type FileSystemProvide API should declare enums starting with 1 #35449
  • 💪 define errors/error-codes
  • readDir should return [name, stat] tuples, not [uri, stat] tuples
  • polish file system activation event, rename to onFileSystem, e.g. onFileSystem:foo
  • should file scheme providers (schemes) be registered in package.json?
  • add subscribe-style-functions for file watching, e.g have a watch(resource: Uri, opts:{ recursive:boolean}): Disposable function
  • support to signal that a fs is case-sensitive

API Evolution

In order prevent breakage of early adopters we work on a copy of the current proposed API. To prevent a lock-step-approach we will "version" the new API. See below

    export interface FileSystemProvider {
        // current api
    }

    export interface FileSystemProvider2 {
        _version: 1;
        // new api
    }

   export namespace workspace {
        export function registerFileSystemProvider(
          scheme: string, 
          fallback: FileSystemProvider, 
          provider: FileSystemProvider2 // <- new world
       ): Disposable;
    }
  • When we make changed to the FileSystemProvider2 the _version-type will change, e.g. from 1 to 2 etc.
  • The registerFileSystemProvider-function will check that the new provider implements the proper version of the latest, proposed API, e.g. _version: 2 and only then register that provider. Otherwise it will use the old, fallback, provider.

/cc @siegebell @bolinfest @hansonw

Sample

A sample, memory-based file system provider can be found here: https://github.com/Microsoft/vscode-extension-samples/blob/master/fsprovider-sample/

Metadata

Metadata

Assignees

Labels

apifeature-requestRequest for new features or functionalityon-testplanremoteRemote system operations issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions