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

Files served by readonly filesystem initially lack the '(read-only)' suffix on tab labels #69651

Closed
gjsjohnmurray opened this issue Mar 1, 2019 · 4 comments
Assignees
Labels
file-explorer Explorer widget issues info-needed Issue requires more information from poster
Milestone

Comments

@gjsjohnmurray
Copy link
Contributor

  • VSCode Version: 1.31.1 and 1.32.0-insider
  • OS Version: Windows_NT x64 10.0.16299

Steps to Reproduce:

  1. Obtain the MemFS sample (git clone https://github.com/Microsoft/vscode-extension-samples and then go to the fsprovider-sample subdir)

  2. Edit package.json to require a newer version of vscode than the sample's default. I changed "vscode": "^1.23.0" to "vscode": "^1.31.0". This is necessary in order to get use of the isReadonly option on vscode.workspace.registerFileSystemProvider

  3. npm install in Terminal

  4. Edit src/extension.ts to add that isReadonly: true to the options parameter.

  5. F5

  6. When Extension Development Host window opens, switch to it, press F1 and run 'MemFS: Setup Workspace', then F1 again and 'MemFS: Create Files'.

  7. Switch to Explorer view.

  8. Single-click on one of the files, e.g. file.js and observe that the tab caption lacks the '(read-only)' suffix.
    image

  9. Try typing into the document and verify it is correctly read-only.

  10. Doubleclick on the tab to persist it. The caption now gets the expected '(read-only)' suffix.
    image

Also notice the weird doubled-up '(read-only) (read-only)' on the titlebar. Is this intentional?

@isidorn isidorn added file-explorer Explorer widget issues under-discussion Issue is under discussion for relevance, priority, approach labels Mar 4, 2019
@isidorn isidorn added this to the On Deck milestone Mar 4, 2019
@gjsjohnmurray
Copy link
Contributor Author

@isidorn I had a go at fixing this issue. I think this is the line where the readOnly state is set on the editor:

textEditor.updateOptions({ readOnly: textFileModel.isReadonly() });

But until there's a repaint of the tab (a simple click on it is sufficient) it doesn't have the ' (read-only)' suffix.

I wasn't able to work out how to trigger this from code after the above line has updated the readOnly option of textEditor. If you can give me a pointer maybe I can submit a PR.

@isidorn
Copy link
Contributor

isidorn commented Oct 8, 2019

@gjsjohnmurray do you still see this? If yes we should make a change here
What is missing it seems is the textFileService should have an event which fires when the model becomes readonly. fyi @bpasero

@isidorn isidorn added info-needed Issue requires more information from poster and removed under-discussion Issue is under discussion for relevance, priority, approach labels Oct 8, 2019
@vscodebot vscodebot bot closed this as completed Oct 15, 2019
@vscodebot
Copy link

vscodebot bot commented Oct 15, 2019

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@gjsjohnmurray
Copy link
Contributor Author

Actually, this just got worse in 1.39 - see #82964

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
file-explorer Explorer widget issues info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants