Skip to content

Added toggle read-only mode (Alt + Shift +R)#82748

Closed
holeguma wants to merge 3 commits into
microsoft:masterfrom
holeguma:master
Closed

Added toggle read-only mode (Alt + Shift +R)#82748
holeguma wants to merge 3 commits into
microsoft:masterfrom
holeguma:master

Conversation

@holeguma

@holeguma holeguma commented Oct 17, 2019

Copy link
Copy Markdown

There is a command called ToggleReadOnlyMode, which toggled read-only mode.
When turned on, all files on editor are in read-only mode.
It can be switched by Alt + Shift + R or menu bar.
This fixes #4873
It's my first time submitting a pull request , I apologize in advance if I made a mistake.

Result:
readonly

@msftclas

msftclas commented Oct 17, 2019

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@holeguma holeguma changed the title add read-only mode Added toggle read-only mode (Alt + Shift +R) Oct 17, 2019
Shinichiro Yoshida added 2 commits October 17, 2019 15:24
@isidorn

isidorn commented Oct 17, 2019

Copy link
Copy Markdown
Collaborator

Hi,

Thanks for the PR. However we usually prefer to first start a discussion about the implementation before going ahead and doing the whole thing.
Your approach seems to touch a lot of editor areas, from the editor core to the snippet controller.
Due to that I am not comfortable merging in this PR. I think the right approach would be just to make the FileEditorInput readonly from the workbench (I am not even sure if that is possible atm, I leave the exploration up to you).

@alexandrudima in case you like the editor changes feel free to review them
I am assinging this to the backlog

@isidorn isidorn added this to the Backlog milestone Oct 17, 2019
@alexdima

Copy link
Copy Markdown
Member

The code editor already has a readOnly option that works 100% correctly. See here

Simply put, the workbench must instantiate all editors and set their option to use readOnly: true to implement this, but there should be no changes inside src/vs/editor since the code editor already supports read only.

@alexdima alexdima closed this Oct 18, 2019
@henrik-jensen

Copy link
Copy Markdown

The code editor already has a readOnly option that works 100% correctly. See here

Simply put, the workbench must instantiate all editors and set their option to use readOnly: true to implement this, but there should be no changes inside src/vs/editor since the code editor already supports read only.

Dear @alexdima: Could you possibly come up with a code example, how to implement this for @holeguma or other potential contributors (or maybe implement it yourself), as this functionality has been on the wishlist for many for quite some time? ( #4873, April 2016, 55 comments ).

@henrik-jensen henrik-jensen mentioned this pull request Feb 8, 2020
@alexdima

Copy link
Copy Markdown
Member

@henrik-jensen My feedback was specific to this PR. The code editor widget already has support to be read only, through the readOnly option. This option is used by the workbench when opening index files from the git viewlet, or when opening files provided by a readonly FS provider.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add read-only mode

5 participants