Skip to content
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

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

Open
hediet opened this issue Jun 20, 2023 · 1 comment
Open

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

hediet opened this issue Jun 20, 2023 · 1 comment
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Milestone

Comments

@hediet
Copy link
Member

hediet commented Jun 20, 2023

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.

@hediet hediet added feature-request Request for new features or functionality editor-core Editor basic functionality labels Jun 20, 2023
@hediet hediet added this to the Backlog milestone Jun 20, 2023
@joebnb
Copy link

joebnb commented Jun 21, 2023

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
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants