Make diff view left side readonly so users don't accidentally edit it

This commit is contained in:
Saoud Rizwan
2024-08-31 07:38:33 -04:00
parent 0f341131fa
commit 3926d1c528
3 changed files with 5 additions and 7 deletions

View File

@@ -94,7 +94,7 @@ export function activate(context: vscode.ExtensionContext) {
)
/*
We use the text document content provider API to show an empty text doc for diff view for new files by creating a virtual document for the new content.
We use the text document content provider API to show the left side for diff view by creating a virtual document for the original content. This makes it readonly so users know to edit the right side if they want to keep their changes.
- This API allows you to create readonly documents in VSCode from arbitrary sources, and works by claiming an uri-scheme for which your provider then returns text contents. The scheme must be provided when registering a provider and cannot change afterwards.
- Note how the provider doesn't create uris for virtual documents - its role is to provide contents given such an uri. In return, content providers are wired into the open document logic so that providers are always considered.