Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vscode] Support all workspace.fs APIs for registered fs providers #7824

Merged
merged 1 commit into from
May 26, 2020

Conversation

amiramw
Copy link
Member

@amiramw amiramw commented May 14, 2020

For this phase only support registered file system providers (and not real file system yet)

Signed-off-by: Amiram Wingarten [email protected]

What it does

Support all missing workspace.fs APIs for registered fs providers: stat, readDirectory, createDirectory, delete, rename and copy.

readFile and writeFile were supported already before this PR.

For the scope of this PR the new supported APIs only work with vscode extensions registered file system providers and not yet support real file system.

How to test

  1. Clone https://github.com/amiramw/vscode-file-system-provider which is a vscode extension that registers inmemory file system provider and exposes commands that test all vscode.workspace.fs methods
  2. yarn
  3. yarn compile
  4. vsce package
  5. Deploy the result vsix file to theia
  6. Test the following commands from command palette:
    • FSP: Test vscode.workspace.fs.stat()
    • FSP: Test vscode.workspace.fs.readDirectory()
    • FSP: Test vscode.workspace.fs.readFile()
    • FSP: Test vscode.workspace.fs.createDirectory()
    • FSP: Test vscode.workspace.fs.writeFile()
    • FSP: Test vscode.workspace.fs.rename()
    • FSP: Test vscode.workspace.fs.copy()
    • FSP: Test vscode.workspace.fs.delete()

Prior to this PR only readFile and writeFile worked. After this PR all of them should work.

Review checklist

Reminder for reviewers

@akosyakov
Copy link
Member

akosyakov commented May 15, 2020

@amiramw I'm rewritting this part now to integrate with Theia FS properly. How urgent is this PR for you? We target to have vscode fs API support as in VS code in 2-3 weeks.

Proposed solution only supports fs providers, not all fs APIs, since disk fs should be integrated properly, plus there are contracts between providers, e.g. when move happens other providers should be notified as well and so on.

@akosyakov akosyakov added filesystem issues related to the filesystem vscode issues related to VSCode compatibility labels May 15, 2020
@amiramw
Copy link
Member Author

amiramw commented May 15, 2020

Specifically it is urgent for us to support delete and readDirectory for fs providers only.
Is the target design completely different? Can I adjust so at least this limited implementation is aligned with it so you don't have to rewrite later?

I don't mind contributing also the fs support (assuming it is not huge effort) but this PR scope is more urgent.

@akosyakov
Copy link
Member

akosyakov commented May 15, 2020

Is the target design completely different?

This code will be replaced by code from VS Code extension host, not our own. We don't want to deviate.

I don't mind contributing also the fs support (assuming it is not huge effort) but this PR scope is more urgent.

That's very involving and we want to do it ourself to avoid long PR reviews. We have the same issue with this PR: #7718 (comment)

If such PRs are minimal, i.e. changes don't affect APIs besides the plugin-ext then someone can review and test, otherwise I don't think we need to accept them. That's an effort and these code will be replaced in 2 weeks.

Also such PRs are distraction from brining the complete solution. Please file issues if you want to work on something. I understand that you spent time implementing it, but I had assigned myself for #7269 and #7127 on purpose.

@amiramw
Copy link
Member Author

amiramw commented May 15, 2020

Will these 2 weeks be within the scope of 1.2.0?

@akosyakov
Copy link
Member

Will these 2 weeks be within the scope of 1.2.0?

I don't think so.

@akosyakov
Copy link
Member

akosyakov commented May 15, 2020

@amiramw your change is pretty isolated compare to #7718 Maybe someone can review it to merge as a temporary solution. I would prefer to focus on the complete solution.

@amiramw
Copy link
Member Author

amiramw commented May 15, 2020

That would be great 🙏

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified using the in-memory filesystem extension which you provided and I see the logs in the output when testing each command. I do see errors however when executing the extension (I'm not sure if it is expected):

Uncaught (in promise) Error: fsp:/a.ts
    at new FileSystemError (/Users/vincentfugnit…/types-impl.js:1280)
    at InPluginFileSystemProxy.handleError (/Users/vincentfugnit…system-proxy.js:226)
    at InPluginFileSystemProxy.<anonymous> (/Users/vincentfugnit…system-proxy.js:214)
    at step (/Users/vincentfugnit…esystem-proxy.js:59)
    at Object.throw (/Users/vincentfugnit…esystem-proxy.js:40)
    at rejected (/Users/vincentfugnit…esystem-proxy.js:32)
    at process._tickCallback (/Users/vincentfugnit…ess/next_tick.js:68)
bundle.js:128248 Uncaught (in promise) Error: 'No available file system provider for schema file
    at new FileSystemError (/Users/vincentfugnit…/types-impl.js:1280)
    at InPluginFileSystemProxy.handleError (/Users/vincentfugnit…system-proxy.js:226)
    at InPluginFileSystemProxy.<anonymous> (/Users/vincentfugnit…system-proxy.js:214)
    at step (/Users/vincentfugnit…esystem-proxy.js:59)
    at Object.throw (/Users/vincentfugnit…esystem-proxy.js:40)
    at rejected (/Users/vincentfugnit…esystem-proxy.js:32)
    at process._tickCallback (/Users/vincentfugnit…ess/next_tick.js:68)
bundle.js:128248 Uncaught (in promise) Error: fsp:/copyFile.txt
    at new FileSystemError (/Users/vincentfugnit…/types-impl.js:1280)
    at InPluginFileSystemProxy.handleError (/Users/vincentfugnit…system-proxy.js:226)
    at InPluginFileSystemProxy.<anonymous> (/Users/vincentfugnit…system-proxy.js:214)
    at step (/Users/vincentfugnit…esystem-proxy.js:59)
    at Object.throw (/Users/vincentfugnit…esystem-proxy.js:40)
    at rejected (/Users/vincentfugnit…esystem-proxy.js:32)
    at process._tickCallback (/Users/vincentfugnit…ess/next_tick.js:68)
2
bundle.js:128248 Uncaught (in promise) Error: fsp:/file.txt
    at new FileSystemError (/Users/vincentfugnit…/types-impl.js:1280)
    at InPluginFileSystemProxy.handleError (/Users/vincentfugnit…system-proxy.js:226)
    at InPluginFileSystemProxy.<anonymous> (/Users/vincentfugnit…system-proxy.js:214)
    at step (/Users/vincentfugnit…esystem-proxy.js:59)
    at Object.throw (/Users/vincentfugnit…esystem-proxy.js:40)
    at rejected (/Users/vincentfugnit…esystem-proxy.js:32)
    at process._tickCallback (/Users/vincentfugnit…ess/next_tick.js:68)
bundle.js:128248 Uncaught (in promise) Error: fsp:/file.txt
    at new FileSystemError (/Users/vincentfugnit…/types-impl.js:1280)
    at InPluginFileSystemProxy.handleError (/Users/vincentfugnit…system-proxy.js:226)
    at InPluginFileSystemProxy.<anonymous> (/Users/vincentfugnit…system-proxy.js:197)
    at step (/Users/vincentfugnit…esystem-proxy.js:59)
    at Object.throw (/Users/vincentfugnit…esystem-proxy.js:40)
    at rejected (/Users/vincentfugnit…esystem-proxy.js:32)
    at process._tickCallback (/Users/vincentfugnit…ess/next_tick.js:68)

@amiramw
Copy link
Member Author

amiramw commented May 16, 2020

I verified using the in-memory filesystem extension which you provided and I see the logs in the output when testing each command. I do see errors however when executing the extension (I'm not sure if it is expected):

I don't see any errors when I tests these changes (both locally and on gitpod). Does it reproduce?

@amiramw
Copy link
Member Author

amiramw commented May 19, 2020

@kittaakos @vince-fugnitto any more comments on this PR?

@vince-fugnitto
Copy link
Member

I verified using the in-memory filesystem extension which you provided and I see the logs in the output when testing each command. I do see errors however when executing the extension (I'm not sure if it is expected):

I don't see any errors when I tests these changes (both locally and on gitpod). Does it reproduce?

@amiramw it is reproducible when running the delete command first (which is likely expected), but I thought that better handling would be present.

@amiramw
Copy link
Member Author

amiramw commented May 19, 2020

I verified using the in-memory filesystem extension which you provided and I see the logs in the output when testing each command. I do see errors however when executing the extension (I'm not sure if it is expected):

I don't see any errors when I tests these changes (both locally and on gitpod). Does it reproduce?

@amiramw it is reproducible when running the delete command first (which is likely expected), but I thought that better handling would be present.

@vince-fugnitto When deleted file does not exist I get: command.ts:15 Uncaught (in promise) EntryNotFound (FileSystemError): fsp:/file.ts
When trying to delete file with file scema I get command.ts:15 Uncaught (in promise) Error: 'No available file system provider for schema file

Do you suggest to handle errors differently? Because I tried to align with the way errors were thrown before in this class, like here: https://github.com/eclipse-theia/theia/pull/7824/files#diff-c908a225bec2806e57d9d1fe1c0ee3c8L70

@vince-fugnitto
Copy link
Member

@vince-fugnitto When deleted file does not exist I get: command.ts:15 Uncaught (in promise) EntryNotFound (FileSystemError): fsp:/file.ts
When trying to delete file with file scema I get command.ts:15 Uncaught (in promise) Error: 'No available file system provider for schema file

Yes, I noticed the errors when first executing a delete.
Once the first delete happens, executions of other commands result in different thrown errors.
I wanted to confirm if this is the intended behavior or out of scope for the pull-request.

Do you suggest to handle errors differently? Because I tried to align with the way errors were thrown before in this class, like here: https://github.com/eclipse-theia/theia/pull/7824/files#diff-c908a225bec2806e57d9d1fe1c0ee3c8L70

I tried your extension in vscode and the handling was better so I thought it was part of the pull-request as well:

Screen Shot 2020-05-19 at 11 57 21 AM

@amiramw
Copy link
Member Author

amiramw commented May 24, 2020

@vince-fugnitto the exception is thrown eventually from the vs code command handler but in theia side such exceptions are ignored.

I don't think that it should be in the scope of this PR.

I wouldn't mind creating another PR and add catch of an exception on:

return handler<T>(...args.map(arg => this.argumentProcessors.reduce((r, p) => p.processArgument(r), arg)));

and print error message.

@vince-fugnitto
Copy link
Member

@vince-fugnitto the exception is thrown eventually from the vs code command handler but in theia side such exceptions are ignored.

I don't think that it should be in the scope of this PR.

@amiramw no problem, I just wanted to bring up what I noticed during testing.
We do have potential improvements for error handling like you described but I do not feel as though it needs to be covered in this pull-request as you mentioned nor is it a critical issue.

@amiramw
Copy link
Member Author

amiramw commented May 24, 2020

@vince-fugnitto any more comments or can this PR be merged?

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amiramw the changes look good to me , I’ll wait to merge tomorrow unless there are any objections :)

…ders

For this phase only support registered file system providers (and not real file system)

Signed-off-by: Amiram Wingarten <[email protected]>
@amiramw
Copy link
Member Author

amiramw commented May 26, 2020

@vince-fugnitto can i merge?

@vince-fugnitto
Copy link
Member

@vince-fugnitto can i merge?

Yes go ahead! I wasn't sure if you have the rights but if you do please go ahead :)

@akosyakov
Copy link
Member

@amiramw Please could you wait till the current build on master is published and then merge?

@amiramw
Copy link
Member Author

amiramw commented May 26, 2020

@akosyakov is it ok now?

@vince-fugnitto
Copy link
Member

@akosyakov is it ok now?

Yes, the last commit has finished, CI has completed and it has been deployed 👍

@amiramw amiramw merged commit 84408de into master May 26, 2020
@amiramw
Copy link
Member Author

amiramw commented May 26, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filesystem issues related to the filesystem vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants