Skip to content

Virtualize global viewport (not just the editor view port) #185647

Open

Description

At the moment, the monaco editor only renders lines in its own viewport (this technique is called virtualization).
However, we can take this one step further: The editor should only render lines visible in the global viewport!

This would allow for scenarios such as this: (image taken from microsoft/monaco-editor#4033)

247039628-2098c4af-53bc-41aa-a062-40c28c1fc7e5

This would be the basis for stacked monaco editors and eventually stacked monaco diff editors.

Demo

Slow example that should be fast - try adding new lines.

Other issues of the demo:

  • Scrolling in the editor does not scroll the parent
  • Widgets are placed at the top of the editor, which might be way outside the global view port

Alternative

You can fake scrolling of the parent and just scroll in the editor like this or this.

Activity

  1. added
    feature-request
    editor-core
    on Jun 20, 2023
  2. joebnb commented on Jun 21, 2023

    @joebnb

    Thanks for attention this issue,and find examples to me.

    btw i have try these examples,but it's seem not work well,beacause this solution work not well cause scroll event not calling every time.
    when scroll fast to top or bottom will drop some scrolling event,it will cause set opposite translate position not accurate.
    image
    some times the value is very large(content already on top the value should be 0)
    image

    this test on macos Safari 16.5 (latest)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    editor-corefeature-request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions