-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
Enable FileSystemProvider to stat a file as readonly #73122
Comments
I think this is generally a nice idea, but I am worried that it will make file operations very complicated: imagine a folder where just a few files are readonly. Now a fs operation runs that operates on all files in the folder, not just one (e.g. rename of the folder? delete?). Naturally with this we would first have to ask the provider if any of the files that are potentially modified are readonly before even starting the operation, which seems quite crazy to me. |
Fair point, but what happens at the moment in such scenarios if the user has set restrictive OS-level file permissions to protect just a few of the files in a folder tree? Does VSCode already run a preflight check on, say, a parent folder delete and decline to start the operation if any of the descendant files isn't deletable? |
@gjsjohnmurray yeah we are not doing anything but rely fully on the OS to do the right thing. If one file in a folder is write protected, the OS may decide that a rename on the parent folder is not possible (have not validated that). |
@bpasero I'd also argue that it shouldn't be VSCode's responsibility to recursively check the readonly stat of every file within a folder before asking the |
@gjsjohnmurray yeah good point 👍 |
Please can this issue get some love soon? |
@jrieken are you open for a PR to implement this? I'm guessing it needs to be treated as proposed API. I'd copy the
|
Proposing API is usually the very last step and requires an "internal" API first and I don't think there is one. I believe that would be around here and than needs options for editors, custom editor etc |
I have submitted draft PR #111237 for comment and guidance. |
One thing to note is that if we decide to push this, the experience for readonly files will be different from how we treat OS readonly files. We would probably not adopt this for OS local files to preserve this current imho inferior behaviour:
With this solution all you see is a readonly editor. |
Little update to #73122 (comment): with 5a8936a there is a new notion of Timing wise I cannot make any better promises than tackling this in our issue grooming iteration. |
I think this shipped in 1.57 so can be closed, right? |
@gjsjohnmurray it is only proposed API, not finalized yet. |
@bpasero sorry, I misread the 1.57 release notes. I often find I miss the point where the "Proposed Extension APIs" section begins. Maybe the text of each subsection of that could helpfully reiterate "proposed API" in future release notes? |
Verification Test that you can mark a file as readonly without enabling proposed API via the @gjsjohnmurray if you are able to verify in current insiders, that would be ideal 👍 |
I hope this isn't considered an annoying question, but what is the process for an api change like this to graduate out of the insiders/proposed status? |
@bpasero thanks, I was already clicking through the wiki, but seemed to have missed that. So without jumping on calls, is there a way I can help move this forward? The change seems quite minimal, and would help 2 extensions I'm developing (both are languages with their own virtual file systems for some parts). I saw this list, in the wiki:
And I'm not completely sure where this should be discussed? Should I raise a new issue, there are already quite a few issues about this topic on file specific read-only status. |
@DavyLandman this API will be available in our upcoming release next week. |
Thanks @bpasero! |
I believe this was verified by #124846? |
/verified First I had to work out how to make fsprovider-sample use the new API because it is no longer in vscode.proposed.d.ts but not yet published in |
Currently a
FileSystemProvider
can register as readonly, meaning that every file it provides is opened in a readonly editor. This is nice, but even better if theFileStat
it returns from its stat() method had an optionalreadonly
property. Then I think this line could easily treat a true readonly value as a signal to setisReadonly
true. @bpasero what do you think?The text was updated successfully, but these errors were encountered: