Skip to content

Disallow edits in-place instead of redirecting #1

@zardoy

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

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