You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Editor is broken when opening files with >120M lines #193164
Does this issue occur when all extensions are disabled?: Yes/No
VS Code Version: 1.83-Insiders
OS Version: macOS
Steps to Reproduce:
Create a dummy file with >120 million lines, each line can just contain one or two characters
Open the file on a system with free memory > 12GB
Once the file is opened, the editor renders the first viewport successfully, however we can't scroll the editor and the scrollbar is also broken 🐛
Turns out in both base and editor we are using | 0 extensively (for example, scrollable) instead of Math.floor, the maximum number the editor code supports is 2,147,483,647. Thus when we open a file with 120 million lines on macOS, each line's line height is 18px with default font settings, the render height becomes 120,000,000*18=2,160,000,000, and unfortunately 2,160,000,000 | 0 = 0 as it exceeds the max value of int32.
Replacing | 0 with Math.floor in the code base can fix this problem but I'm not sure if it will unveil other problems. There is also performance penalty of using float instead of integer32.
We could try to fail gracefully and use telemetry to find out how often files with >120M lines are opened to justify moving away from SMIs in these places.
Activity
alexdima commentedon Sep 15, 2023
We could try to fail gracefully and use telemetry to find out how often files with >120M lines are opened to justify moving away from SMIs in these places.