GreenRover
GreenRover

Reputation: 1516

VS-Code Extension: vscode.window.activeTextEditor == undefined

I wrote an Visual Studio Code extension. Based on this example: https://github.com/Microsoft/vscode-extension-samples/tree/master/previewhtml-sample

var editor = vscode.window.activeTextEditor;
if (!editor) {
    console.log("No open text editor");
}

This works fine if i open a 2MB File. But not if the file is 5MB or larger.

But if I copy (Ctrl+C,Ctrl+V) a 10MB into a new editor it will work and is prety fast. Has anyone an idea what kind of limitation this is?

Or is there perhaps a work around by some how let user choose a file in command. To directly read the file?

Upvotes: 0

Views: 2878

Answers (1)

Matt Bierner
Matt Bierner

Reputation: 65493

This was addressed upstream in this issue

The root cause was that VS Code did not properly create text editors for files over a certain size. That size limit has since increased but you still may run into this limitation for very large files

Upvotes: 1

Related Questions