microsoft / microsoft/monaco-editor

[Bug] Minimap tied to end of file stops after a couple of seconds

Open
#4,361 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.45.0#XQAAAALlAgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw2j7JnW5hX37vz5Dmz9vpGlCqJDoAaVOfZN518-ujYFf2YSN05RU2izPcyjdPIj17v3FEloMIUNhn2W-Rmfl-oo2oq3ZkG21izaO71B5y8r0X6ApVGA5ytO3EQ8iEV_5pXE-Zhh6EyqPUf_ZXl8OO-IK-JifPaK-lJYywczSNSIkLgI-totby8kRnHz3flo61eOAISwptRCYlI0qWPZiZzw-BKnlSEnZR0nsJZiwrMxsA7oIM9DVGL8QAkVx1VHGd-cJ56s2iW0lYObNBLo628VrsPeejxV3vSWN-YKQYV1oua6IoZrao9UqGMw36npwf0-C-Iy0DsT-tFwgBwSQyA76MOmgSwD5iCwaXI6WRJCD0CmZd_b0bQGoRbS-K8r7MXXDq66I6nqL46To3fuiW-mQAMUNh4B9E_nRnvzwfmffyZzL4ok6Ksrvj4REiTppCQG_BxwKoj7-MBA5OCTRskEZ0ZkibZHTcxjp4wUDyLcLj_-FWT00

Monaco Editor Playground Code
let value = /* set from `myEditor.getModel()`: */ `

`;

const addValue = `
new line 
new line 
new line 
new line 
new line 
new line 
new line 
new line 
new line 
`;
value = "";

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "javascript",
	automaticLayout: true,
	scrollBeyondLastLine: false,
});

function setTimedInterval(callback, delay, timeout){
    var id=window.setInterval(callback, delay);
    window.setTimeout(function(){
        window.clearInterval(id);
    }, timeout);
}

setTimedInterval(()=>  myEditor.getModel().setValue( value += addValue), 300, 12000);
Reproduction Steps

While the interval is adding new lines:
Wait until the new lines are beyond the view.
Take the minimap and drag the rectangle to the end of the file.

Actual (Problematic) Behavior

This will make the view attach/stick to the end, but after a couple of seconds, the view will stop to follow the end of line.

Expected Behavior

If the view is attached to the end, stay this way until the user does any action that cancel this.

Additional Context

Also, I would like to know if there is any option or config to make this "attach to end" or why its happening, didn´t find any option in the docs regarding this.

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.

Research direction

Run the Monaco Editor Playground link with the supplied TypeScript reproduction and observe the minimap while setValue adds lines beyond the viewport. Start by tracing the editor's minimap drag and end-of-file scrolling behavior; done means that dragging the minimap view to the end keeps following appended lines until the user performs an action that cancels it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.