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

Opening a workspace that uses a FileSystemProvider extension for its open files initially adds '(read-only)' suffixes to tab labels #91833

Closed
gjsjohnmurray opened this issue Mar 1, 2020 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release verified Verification succeeded workbench-editors Managing of editor widgets in workbench window
Milestone

Comments

@gjsjohnmurray
Copy link
Contributor

Issue Type: Bug

This issue does not occur in 1.42.1

To reproduce:

  1. Clone vscode-extension-samples and open fsprovider-sample.
  2. Run this sample.
  3. In Extension Development Host run the MemFS: Setup Workspace command followed by MemFS: Create Files
  4. Open one of the files, for example file.ts
  5. Save the workspace
  6. Close the workspace
  7. Reopen the workspace. Observe how the file that had been open when the workspace was closed gets its tab restored but with the '(read-only)' suffix.

Ignore the fact that the tab disappears almost immediately. This is a consequence of the MemFS filesystem not being a persistent one, meaning that the restore logic is unable to restore contents for the file.

When tested with a FSP that accesses persistent storage, the previously-open file gets correctly reloaded. The spurious '(read-only)' suffix on the tab label disappears when the tab is clicked on.

I think the bug arises because the extension that implements the scheme specified by the restored file's URI hasn't yet been activated by the time this code gets called:

if (!this.fileService.canHandleResource(this.resource)) {
return true; // resources without file support are always readonly
}

But I haven't yet discovered what changed in 1.43 to cause this regression.

VS Code version: Code - Insiders 1.43.0-insider (17c6d12, 2020-02-28T12:46:02.355Z)
OS version: Windows_NT x64 10.0.18363

@gjsjohnmurray
Copy link
Contributor Author

Based on #48259 (comment), pinging @bpasero and @isidorn

@bpasero
Copy link
Member

bpasero commented Mar 1, 2020

Yeah I think we are just missing to listen for capability changes. One change that happened from previous release is that we consider a file editor as readonly if no provider is registered.

@bpasero bpasero self-assigned this Mar 1, 2020
@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug workbench-editors Managing of editor widgets in workbench window labels Mar 1, 2020
@bpasero bpasero added this to the March 2020 milestone Mar 1, 2020
@bpasero bpasero closed this as completed in f250297 Mar 2, 2020
@gjsjohnmurray
Copy link
Contributor Author

@bpasero thanks for fixing this so quickly. I have confirmed that an OSS build from master just now has resolved the issue for my FSP as well. Any chance of it being a Candidate for 1.43?

@bpasero
Copy link
Member

bpasero commented Mar 2, 2020

Thanks for verifying, I do not think this qualifies as a backport fix to be honest but I could be convinced if there is good reasoning.

@gjsjohnmurray
Copy link
Contributor Author

gjsjohnmurray commented Mar 2, 2020

Scenario is that a user has a workspace that gets files through a FSP extension (e.g. Remote FS). Then the 1.43 update lands. When VSCode reloads I suspect the tabs of all the open files will show the '(read-only)' suffix. Actually the files are still editable, and clicking on a tab will correct all the labels. But it's not going to be an encouraging first encounter with 1.43.

@bpasero bpasero reopened this Mar 2, 2020
@bpasero bpasero added the candidate Issue identified as probable candidate for fixing in the next release label Mar 2, 2020
@bpasero bpasero modified the milestones: March 2020, February 2020 Mar 2, 2020
@bpasero bpasero closed this as completed Mar 3, 2020
@isidorn isidorn added the verified Verification succeeded label Mar 3, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release verified Verification succeeded workbench-editors Managing of editor widgets in workbench window
Projects
None yet
Development

No branches or pull requests

3 participants