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] Running example FileSystemProvider plugin has different behavior #8167

Open
Glamhoth opened this issue Jul 14, 2020 · 7 comments
Open
Labels
bug bugs found in the application help wanted issues meant to be picked up, require help vscode issues related to VSCode compatibility workspace issues related to the workspace

Comments

@Glamhoth
Copy link

Bug Description:

When trying to use example FileSystemProvider plugin the (expected) behavior on Code[1] differs from the behavior on Theia[2].

[1] Running plugin command Setup workspace with or without opened workspace creates new and empty directory with name that was passed to vscode.workspace.updateWorkspaceFolders in extension.ts.
image

[2] Running plugin command Setup workspace without opened workspace throws an error Failed to update workspace folders: Error: There is not active workspace. If any folder was already opened in the workspace, the same plugin command opens new directory, but instead of named, empty one it's system's root.
image

Steps to Reproduce:

  1. Clone microsoft/vscode-extension-samples
  2. Add fsprovider-sample plugin to Theia
  3. Run Theia
  4. Execute Setup workspace command from the command paletter

Additional Information

  • Operating System:
    Ubuntu 18.04 if running on Docker image
    Arch Linux, kernel 5.7.7 if running on host
  • Theia Version:
    Tried both release 1.3.0 and compiling akosyakov/integrate-vscode-api-7269 branch.
@akosyakov akosyakov added filesystem issues related to the filesystem vscode issues related to VSCode compatibility labels Jul 14, 2020
@akosyakov akosyakov self-assigned this Jul 14, 2020
@akosyakov akosyakov added workspace issues related to the workspace and removed filesystem issues related to the filesystem labels Jul 14, 2020
@akosyakov
Copy link
Member

Thought it is related to fs APIs, but it is related to workspace APIs. I think it is known bug that we don't respect workspace names yet.

@akosyakov akosyakov added bug bugs found in the application help wanted issues meant to be picked up, require help labels Jul 14, 2020
@akosyakov akosyakov removed their assignment Jul 14, 2020
@Glamhoth
Copy link
Author

How does workspace support for custom scheme/filesystem provider look like? In the example plugin a memfs scheme is registered, but even if I try to manually edit the workspace file it's not recognized.

@akosyakov
Copy link
Member

akosyakov commented Jul 15, 2020

I don't think it is related to fs providers, it is about:

vscode.workspace.updateWorkspaceFolders(0, 0, { uri: vscode.Uri.parse('memfs:/'), name: "MemFS - Sample" });

We ignore currently MemFS - Sample all together. I've started working on it once, but did not have time to finish: #7222

@Glamhoth
Copy link
Author

But this plugin registers provider
vscode.workspace.registerFileSystemProvider('memfs', memFs, { isCaseSensitive: true });
so I thought that if I would create workspace in Theia and then manually edit it to point at folder in memfs schema like this:

{
    "folders": [
        {
            "path": "memfs:///folder"
        }
    ]
}

it would correctly show those files that are initialized by memfs.init command. Instead path changes to this: /home/glamhoth/.theia/memfs:///folder, which seems like workspace is always treating uris as they would be in file schema. It's not related to names probably, but maybe am I missing/misunderstaning something, or schema stuff is not fully implemented in Theia's workspace?

@akosyakov
Copy link
Member

I see, it looks like another bug in our WorkspaceService.

@shomeier
Copy link

shomeier commented May 17, 2021

I also just tried to implement an own FileSystemProvider and got the same issue.

It looks like the problem is in WorkspaceService.transformToAbsolute:

    if (path.startsWith('file:///')) {
        folders.push(path);
    } else {
        folders.push(workspaceFile.resource.withScheme('file').parent.resolve(path).toString());
    }

If I remove the lines 1,3,4 and 5 and simply push the path to the folders array my FileSystemProvider is hit properly with its scheme.

@umar-shabbir
Copy link

umar-shabbir commented Nov 23, 2023

I faced the same issue in my custom extension where I am using vscode.workspace.updateWorkspaceFolders to add folders in workspace. Works fine in VS code.
Is there any update on this bug?

Theia version: 1.43.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application help wanted issues meant to be picked up, require help vscode issues related to VSCode compatibility workspace issues related to the workspace
Projects
None yet
Development

No branches or pull requests

4 participants