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

Allow FileSystemProviders to set the read-only file message #166971

Closed
alexr00 opened this issue Nov 22, 2022 · 1 comment
Closed

Allow FileSystemProviders to set the read-only file message #166971

alexr00 opened this issue Nov 22, 2022 · 1 comment
Assignees
Labels
api api-finalization feature-request Request for new features or functionality on-testplan

Comments

@alexr00
Copy link
Member

alexr00 commented Nov 22, 2022

In the GitHub Pull Request and Issues extension, we show PR diffs using a FileSystemProvider and make them read-only when the PR is not checked out. This makes sense since the file is not available on the local system, so there's nothing there to edit.

However, users want to edit these files and are confused when they get the "Cannot edit in read-only editor" message when they start typing (microsoft/vscode-pull-request-github#3450)

image

I'd like to encourage users to check out the PR when they try to edit these read-only files. One option to do this would be to change the "Cannot edit in read-only editor" message to "Checkout the pull request to edit this file", or even better to have a markdown popup that shows so I can actually give them a link to check out the PR.

To that end, maybe isReadonly, could take a string or, even better, a markdown string:

vscode/src/vscode-dts/vscode.d.ts

Lines 12613 to 12614 in 94ee5f5

export function registerFileSystemProvider(scheme: string, provider: FileSystemProvider, options?: { readonly isCaseSensitive?: boolean; readonly isReadonly?: boolean }): Disposable;

@alexdima alexdima added feature-request Request for new features or functionality api labels Nov 25, 2022
@alexdima alexdima added this to the On Deck milestone Nov 25, 2022
@alexr00 alexr00 self-assigned this Jun 14, 2023
@alexr00 alexr00 modified the milestones: On Deck, June 2023 Jun 14, 2023
alexr00 added a commit that referenced this issue Jun 15, 2023
@alexr00
Copy link
Member Author

alexr00 commented Jun 15, 2023

Proposal ( | MarkdownString):

export namespace workspace {
export function registerFileSystemProvider(scheme: string, provider: FileSystemProvider, options?: { readonly isCaseSensitive?: boolean; readonly isReadonly?: boolean | MarkdownString }): Disposable;
}

alexr00 added a commit to microsoft/vscode-pull-request-github that referenced this issue Jun 16, 2023
alexr00 added a commit that referenced this issue Jun 21, 2023
* wip

* Allow extensions to provide a readonly message
Part of #166971

* Address feedback

* Further address feedback

* Fix some nits

* Add test

* Improve tests and respond to feedback

* Don't render editor.readOnlyMessage in the settings UI

* No need to validate the IMarkdownString

---------

Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
Co-authored-by: Alex Dima <alexdima@microsoft.com>
alexr00 added a commit to microsoft/vscode-pull-request-github that referenced this issue Jun 22, 2023
* Add read-only message for unchecked out PR files
Part of microsoft/vscode#166971

* Update readonly message
@alexr00 alexr00 modified the milestones: June 2023, On Deck Jun 22, 2023
@alexdima alexdima removed their assignment Sep 14, 2023
@alexr00 alexr00 modified the milestones: On Deck, December / January 2024 Dec 13, 2023
alexr00 added a commit that referenced this issue Jan 11, 2024
Finalize read-only message file system provider API
Part of #166971
@alexr00 alexr00 closed this as completed Jan 19, 2024
@aiday-mar aiday-mar added this to the December / January 2024 milestone Feb 6, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api api-finalization feature-request Request for new features or functionality on-testplan
Projects
None yet
Development

No branches or pull requests

5 participants