Skip to content

Disallow edits in-place instead of redirecting #1

Description

@zardoy

Hi, gonna be honest, didn't check, but my friend recommended it. I'll just attach the code:

// 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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions