getVisibleRanges: allow for partial visibility

Open
#2,254 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
frontend

Research direction

Start with the Editor#getVisibleRanges API and trace how it determines vertical visibility. Review the existing behavior and consider the reported backward-compatibility concern before deciding whether partial visibility should be supported through an additional argument; done means the API handles the requested scroll-synchronization case without breaking current behavior.

Written by the indexing model from the issue text.

Description

editor-api feature-request

Currently Editor#getVisibleRanges includes only lines that are fully visible, at least vertically.

I think that may be a mistake because when implementing scroll synchronization this creates discontinuities between lines, e.g. you synchronize the top of line 1, which is let's say 20px tall, which is at the very top of the editor, now if you scroll just one pixel down that line is considered not visible, even though most of it is actually visible still, and crucially the next visible line will be ~19px below, causing a jump in the synchronization. If instead partially visible lines are considered visible that would smooth out all the discontinuities.

Maybe this can't be changed for backwards compatibility, but at least an extra argument for controlling this behavior would be pretty useful.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/monaco-editor

All issues in microsoft/monaco-editor

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.