Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

Error on read editor.document property in preview file #377

Open
hanc2006 opened this issue Feb 25, 2018 · 0 comments
Open

Error on read editor.document property in preview file #377

hanc2006 opened this issue Feb 25, 2018 · 0 comments
Assignees
Labels
Milestone

Comments

@hanc2006
Copy link

If you enable the workbench.editor.enablePreview : true on vscode and you open a preview of a file the the plugin goes wrong.

ERR Cannot read property 'document' of undefined: TypeError: Cannot read property 'document' of undefined at QualityOfLife.onChangeEditorHandler (C:\Users\hanc\.vscode\extensions\HvyIndustries.crane-0.3.8\out\src\features\qualityOfLife.js:29:19) at QualityOfLife.vscode.window.onDidChangeActiveTextEditor.editor (C:\Users\hanc\.vscode\extensions\HvyIndustries.crane-0.3.8\out\src\features\qualityOfLife.js:16:68) at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:88:729) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:660:559 at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:88:729) at e.$acceptDocumentsAndEditorsDelta (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:658:904) at e._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:584:983) at e._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:584:701) at e._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:583:836) at e._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:583:605) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:582:671 at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:585:523 at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:87:459 at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:88:729) at Socket.<anonymous> (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:146:633) at emitOne (events.js:96:13) at Socket.emit (events.js:191:7) at readableAddChunk (_stream_readable.js:178:18) at Socket.Readable.push (_stream_readable.js:136:10) at Pipe.onread (net.js:560:20)

I changed in file qualityOfLife.js this line of the code and seems to work

onChangeEditorHandler(editor) {
        // Only process PHP files
        if (editor != null && editor.document.languageId != "php")
            return;
        this.styleTodoComments();
    }

I hope it can be useful
Thx

@nevadascout nevadascout added this to the 0.4.0 milestone Feb 28, 2018
@nevadascout nevadascout self-assigned this Feb 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants