Skip to content

Editor is broken when opening files with >120M lines #193164

Open

Description

@rebornix

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.83-Insiders
  • OS Version: macOS

Steps to Reproduce:

  1. Create a dummy file with >120 million lines, each line can just contain one or two characters
  2. Open the file on a system with free memory > 12GB
  3. 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.

Activity

  1. added
    feature-request
    on Sep 15, 2023
  2. alexdima commented on Sep 15, 2023

    @alexdima
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-corefeature-request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions