[vscode] Workspace doesn't support listing files/directories with schemas other that `file://`
#8,178 opened on Jul 15, 2020
Description
Bug Description:
Bug came out in the discussion under #8167.
When trying to use example FileSystemProvider plugin the (expected) behavior on Code[1] differs from the behavior on Theia[2]. I'm pretty sure that the problem lies in WorkspaceService, as my small test[3] shows that Theia can correctly access files with different schema.
Plugin registers it's own FileSystemProvider like this:
vscode.workspace.registerFileSystemProvider('memfs', memFs, { isCaseSensitive: true });
[1] Running commands memfs.workspaceInit and memfs.init create new workspace and populate it with directories and files with uris in memfs schema. All of them are correctly visible in the workspace tree. Workspace file looks roughly like this:
{
"folders": [
{
"name": "MemFS -Sample",
"uri": "memfs:/"
}
]
}
[2] As said in issue mentioned above, Theia currently ignores workspace names. 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 /home/glamhoth/.theia/memfs:///folder, which seems like workspace is always treating uris as they would be in file schema.
[3] I added additional commands. One to create a file (through MemFS file provider) and open it (via URI). Second to display message with uri of currently opened file. In both Code and Theia file opens and it's URI is correct. By this I assume that custom scheme/fs provider is present and works fine.
context.subscriptions.push(vscode.commands.registerCommand('memfs.addandopen', (_) => {
memFs.writeFile(vscode.Uri.parse(`memfs:/test.txt`),
Buffer.from('this is test file'),
{ create: true, overwrite: true });
vscode.workspace.openTextDocument(vscode.Uri.parse(`memfs:/test.txt`))
.then(doc => {
vscode.window.showTextDocument(doc);
});
}));
Steps to Reproduce:
- Clone
microsoft/vscode-extension-samples - Add
fsprovider-sampleplugin to Theia - Run Theia
- Execute
Setup workspaceandCreate filescommands from the command palette
Additional Information
- Operating System: Ubuntu 18.04 if running on Docker image Arch Linux, kernel 5.7.7 if running on host
- Theia Version:
1.3