-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
openTextDocument resolves but returns undefined for files larger than about 4MB #43861
Comments
I am having this exact same problem - I have saved a file to disk that's over 50MB and then want to open and show the file. The issue is that in mainThreadDocumentsAndEditors._updateState it doesn't call onDidStateChange for large files. Hence the mainThreadDocument manager never gets the notification, and returns undefined. This seems inconsistent - this works with File -> Open, but programmatically fails when an extension tries to do the same thing. A workaround would be a single "open and show" command that doesn't register the file as usable by language services, but guarantees it'll open. Repro of code that will fail with large file:
|
Yeah, we should probably reject the promise... This challenge is that we technically support opening this (and do so) but we don't sync it to the extension host. |
That actually could work with the |
@StephenWeatherford I have pushed a change that rejects the returned promises with proper error message. We are a bit confused about the 4MB limit you have mentioned because since a few months the limit is 50MB. Where does that number come from? In order to open very large files from an extensions you can use the vscode.commands.registerCommand('extension.sayHello', () => {
return vscode.commands.executeCommand(
'vscode.open',
vscode.Uri.file('/Users/jrieken/Code/_samples/ConsoleAppDnx/large2.txt')
);
}) |
I can verify that the error message shows. |
Just as an FYI, the workaround to call the |
Steps to Reproduce:
const document = await vscode.workspace.openTextDocument(localFilePath);
NOTE: You can see this in my extension by following these steps, if you have an Azure subscription:
!) the download succeeds, but the open fails
The text was updated successfully, but these errors were encountered: