Repository: vscode
Issue: Virtualize global viewport (not just the editor view port)
Labels: feature-request,editor-core

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 https://github.com/microsoft/monaco-editor/issues/4033)

![247039628-2098c4af-53bc-41aa-a062-40c28c1fc7e5](https://github.com/microsoft/vscode/assets/2931520/5dce087c-90d1-4b88-a79d-fbd7f2f551a8)

This would be the basis for stacked monaco editors and eventually stacked monaco diff editors.

# Demo

[Slow example that should be fast](https://microsoft.github.io/monaco-editor/playground.html?source=v0.40.0-dev.20230619#XQAAAAKCBAAAAAAAAABBqQkHQ5NjdNKrG-jY7SIQ9S7DNlzs5W-mwj0fvjrVj-bcGwaHRb_geXXE-Cc-TtHJe8qDrhoG4ru6WflcsesZPIaZnoyZbTvf-t0G91Mk7bBhGbpOY1qmEiqcMuXqzXMh4dmmZk0mW2pfoJ_MzI0bFnccEDyFoxp4VOm1RGC2dmueDv31RTYslZ5knu3sX8r1OU-xFmuEk9bfvRaeQq_bKS_YGkDLjTXxXgxxCObns1ovm5AGpnPsw4bsBTI7AYAfxucGz1b-ZkbLidw0DDbUK_gpxWW5O_3RHWHOVPGSj-YrXkgu9wYUohJVr6t461eK1MSOmIeME8b-RLt2O4-1bnY_FI2QXPvLqF2Iy5nSwo2iICfWTJUsGpOG578LdP11AyMJW3UZA4H8WR72ePZPfn8YIBMTLC3JzvRgLFmNKEImSjSX-6lVsd7-SWyO4ORtuZuqI6dDXujSDRLAgJQimTTcjlsQpvlmhVI3N8428oedPcEGZEJpYDDzsbUQcYhiEz9pjt2OoEz86ayohq-oaWDnXAJT4yEdCmQl2DHwuWRtFKbrUU3IfhYPhcX2Psse2SEHeS3xE17PY1YjEY1IbTFKBiiTLgd6ztg8l9_2Zz_ObMhnv1O81yhOFwjvrjWLC5gC4QEJ2_vhFRw_WjOjAVwSCZcsIxtrctFk2xC1YRuMzhAPjksUyFUIZHIxVy6lEnI4QqIwI9qrNdGmyor8RMYTbGGM5XMejrZWaIJSlxBmvp90ZyR4V52530ye94a1nT5SMg5i54s9Ni4cPh16NnN19LAtbU--_uq1WJQz_GRgnw) - 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](https://microsoft.github.io/monaco-editor/playground.html?source=v0.40.0-dev.20230619#XQAAAALmBwAAAAAAAABBqQkHQ5Njdzm-ycJxIP9xmco32QA-Lc78yfJeNbANJ8UqMVcpQDaXIGvryFyM5X5yW60V5Zw-ghbWGrfEFQPEkXFG5AglMedU8cWrpOTyKsb7pmwV58Qe9EdC2mEqZxiQovex08pf6fyMJnLEugO3CyJSYD659sUHZUOFE_m0pQFZIEhvPRGArAilSXdWaYLP_iG7zXjGECys10xkexzOCTc9JYoKmn_u5LHRMS_1mM8EbzVMu6jzRFsQwhx8V6q_jOXuf_4Q39zybNLewiGB5lMlgyG7_o4u2lSgIscchK626U4lK1xBM5vzsEBgcVNAroP-PJqZ9dQvMtOtUW8t06RT-dg7pb39o0fQCcpWWYWr3-DcXu_MyafxmxklQqBayHeHLafxGM5KAb60-zgRCvgqIFJvbIfZpk31Oa3XkoN107zpA6VfBA7Rx9F3BNuFNiMhJuLSTq0JkJ19SRM7COZ04Bwncf58J4WuZPygQm-c3L3ADqkKDZd5w_oxU8bBQWXAz82O0KsrJPe635nRfhqmpnkZZjvYceIf52wMcjXGuIw_BBSm7UMzGNgIRUUda_QxPSpUw08RuLUmJd0dNAj_NZmS0p5A6q6MqQETrf6Ou1m3RaUmnNDftbc5JpYRiSdEBify2EoIaoed5IPSCpc-iRKbC7iGy678GnvcysI-NN3qGneyTSUJVMCMpIiqXXZ0KPe1BSMKsnUGC68OTvSRg9INq-NnuQ7e_mL_KqilD9_ET-CNMa1DDYJnsvDLsrJoxB4rWOodoBXRnOmD50doN6wDYbhJTzWhDvXHiqCBx4CCX7HhjUWuoiCCCqwj34jptez3IkM7RBRRQx_1cO6HIgWeXJ8KcXylJqQKwTslq3FTdbPQO8JjHU1OKArHHSdICsAzEQohd1Nnt7QwhpURVYiIa3NkI5wIs_kC4hNFz-GF77srQnkruZ4zBP_ql2tL) or [this](https://microsoft.github.io/monaco-editor/playground.html?source=v0.40.0-dev.20230619#XQAAAALWCgAAAAAAAABBqQkHQ5NjdznF70JxIP9xmco32QA-Lc78yfJeNbANJ8UqMVcpQDaXIGvryFyM5X5yW60V5Zw_cO1kDjK-Evk5lBgsTiXswpVe0uUsksBkPk-ZZ6kF93pCM9iirx9P02NMmV_uqcwu69gGCkZhg60Hi8QVp404jYhHenZljsODjv1DBSE5NGYryh0FHbzsY6WGZ13XoOJ2ZFHS3Y1L7YwzzHmjaQXMrUAPcguSY4Ys1aoVtuYgevbU484Y5BhT3M8tKlV4nhtYqa_V6CceP9SXVkwjrNfEQxQndpDi3L_GzA_o9ySRvqkgQCEnxHP3NHovHOOevgm9WVH-0D_MEC2cFYcLPIdCABupD0sfjD3FwGlqOHihIxPIR8Ylna_Gkzk7iuc8xeP2878zg7ZVrEXU0aPwkX1ODVMxpli6vzCqEypquWD8ruPJCvvT5l7F6huzUYyzpCyWklXnkMFCtBruqqJmMRiUykZEv_twN57WB8ORwXMrXCVuFxILhudmWqFK0-kYGY1HvKLvTx9DAZKGDKpKzWJ-DWjQTv1raTyE9p_8iK0w7vdaINTTXWBRFbU3wTax0es9T-rJdUCRHjB4TQ05lntveFsoSNToxE2CcfrsL7EU4Qs3vNv1Bqj1O792USBx7LQRRv04tQz4S9erCINBU_UTj_lPKCaulPFmZqJa-VuMMdlb_Xii3LKCQgfCIzTwRwHw4FW2nJXSi81Dhp2c2pFoxFCoN-3wMq6fueWgPSrUfHnYF1bw7bhwGmw-QNBhdp7p8KAuhkw8iK0b-oxq0-Hk0VhJEooAk6n4sumxmAhhz-eAjEzl6gg8CSOloakKYJTY-l3rlMzWtvVBtjErMQTyHuQKcZx8Afo4Q5yFciyzV97Lku0F01FMwTMLMhp36roCJ10jCa0yhT7xU1QqObav3Bi1iOOEzDR9emSLfbRgu1CdK4nr_UJWmUlR-6mD19Ci70WDcohzAs-Ox69ySVLEnWhdIhz1FC62hMDWpctuFclajiOpB_YEk4gvESEOXxVEzwki6pn98tFQ7MU65VS7eUTB-j_gxu7TlOZETwb9arz2dC2jxe06RsSK0vgTshyJJnpVIhWwJlRqsBTgernfw7WVURmfgztkT_zk2u5I9XQBWaPqCkpBPf9Z7z8A).