-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
vscode.window.activeTextEditor is undefined for files larger then 5MB #32118
Comments
When we open a file (and only when opening it), we classify it:
We have implemented these graceful degradation limits based on our experience in dealing with large files. i.e. we have found very many language servers struggle with file sizes above 5MB so we decided to introduce a limit at the extension host layer. This classification can be circumvented by editing a file. i.e. start with a small file, and then use ctrl+c ctrl+v to increase it to a size above 5 MB, etc. The above classification is made only when the buffer is created. |
In case of a LARGE file: Is it possible for an extension to get whole file contenst? |
No, I'm sorry, opened files over 5MB are currently completely hidden from the extension host. I believe we took this decision at a time before we had such a rich extension ecosystem and it is perhaps time to revisit it. i.e. we should consider removing this restriction and push the responsibility of dealing in a smart way with large files down to the extensions themselves. |
Hi can you tell me the variable where the 5MB is stored in to let me hack my local vs code? |
@GreenRover Here's the location: https://github.com/Microsoft/vscode/blob/88be6de0b7ac0ac787a6ea9c472c1d7b2ca2d380/src/vs/editor/common/model/textModel.ts#L33 In the built |
Hi a changed this value in workbench.main.js and tryed to open a 21MB file but it failed. |
No, that single constant is responsible for the limitation. @jrieken I suggest I simply increase the constant. Did we ever document the limitation? i.e. extensions will begin seeing larger files after this change, I hope nobody built their extensions on the constraints that they don't need to deal with files larger than 5MB. |
I don't think so |
I increased the limit to 50MB |
I wrote an Visual Studio Code extension. Based on this example: https://github.com/Microsoft/vscode-extension-samples/tree/master/previewhtml-sample
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?
The text was updated successfully, but these errors were encountered: