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

[FEATURE] - Read-only via vscode API (alternative mode) #83

Closed
zardoy opened this issue Mar 17, 2023 · 5 comments
Closed

[FEATURE] - Read-only via vscode API (alternative mode) #83

zardoy opened this issue Mar 17, 2023 · 5 comments

Comments

@zardoy
Copy link

zardoy commented Mar 17, 2023

Hi, I propose to add an alternative mode to extension so it uses vscode API, I believe it would resolve most of issue and make it work on the web:

// code that implements it
vscode.workspace.onDidChangeTextDocument(({ document, contentChanges }) => {
    const activeEditor = vscode.window.activeTextEditor
    if (activeEditor.document !== document || contentChanges.length === 0) return
    vscode.commands.executeCommand('undo')
    vscode.commands.executeCommand('editor.action.goToLocations', document.uri, new vscode.Position(0, 0), [], '', 'File is read-only')
})

image

@alefragnani
Copy link
Owner

Hi @zardoy ,

I'm not sure which issues are you referring to but, AFAIK, the workspace.fs API still doesn't work for remotes/web, as microsoft/vscode#48659 is still open. BTW, remote support is being tracked in #18.

But, if you have seen any OSS extension dealing with permissions on remotes, you could try applying the same approach here. And if it works, I would be happy with a PR.

Thank you

@zardoy
Copy link
Author

zardoy commented Mar 17, 2023

Hi, @alefragnani

I suggest to introduce a setting, so extension would interrup text changes within editor (as I understand this is the main goal of the extension) instead of touching files in FS, I also wonder how are you going to use vscode.workspace.fs API 🤔

@alefragnani
Copy link
Owner

The extension's purpose is not interrupt changes in the editor, but simply display if the current file permission (writable/read only). Ok, it also allows you to change that, but it does on a file system level, not simply the editor.

In fact, read only mode does not exist today in VS Code. Yes, some operations blocks editing, but an effective read only does not exists yet microsoft/vscode#4873.

@zardoy
Copy link
Author

zardoy commented Mar 17, 2023

In fact, read only mode does not exist today in VS Code. Yes, some operations blocks editing, but an effective read only does not exists yet microsoft/vscode#4873.

This is the exact reason is why I was looking for your extension, anyway thanks for clarifying the fact that this extension is for working with file permissions only.

@zardoy zardoy closed this as not planned Won't fix, can't repro, duplicate, stale Mar 17, 2023
@alefragnani
Copy link
Owner

No problem 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants