microsoft / microsoft/monaco-editor

[Bug] stickyScroll ignores maxLineCount? Only sticks 1 line (for language less)

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

Nobody has claimed this yet.

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.52.2#XQAAAAKpAgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw2L-o3Juetpg8d5BCIdogK6CBmgyKHIOVjH6uO-oA-RA-rcpQdGBlgwMT7NDeGjyzFj7FroYDLI_hWtBVjnElD1MUhtF6Dg98vnU4WDHkz6r4nSG0e5efhWvGfKoOo1u2GxvLnCwcRop2ayU-r7T6pWRrFJs0caSKsAVzdq-LK4HK097X8Mx7b0oHTcx0FV0mcN7C4IbkxtWLXD8Pm9R333no_zbfYUYd8dHXrD67KNWDhwfSfmeuceRxs-SIXAqXv_fNaejJ9tL6n3SoFx8cbk7gV-aWbNutxaqcz9SFIBNFPBle4RLP8ZWR4c3_P1K6ZIqwyZLW4KgpFHF4Nom5jRjL8p50pi4jhxJnHWJgNt6yBwW6erZugG3xcc-JD8pkPOzzZulvmXi2kx-QDv_17QTv

Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `#id-1 {
	border: 1px solid red;
	#id-2 {
		border: 1px solid red;
		.class-1 {
			border: 1px solid red;
		}

		#id-4 {
			border: 1px solid red;

			#id-5 {
				border: 1px solid red;

				.class-2 {
					border: 1px solid red;
				}

				#id-6 {
					border: 1px solid red;

					.class-3 {
						border: 1px solid red;
					}
				}
			}
		}
	}
}`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "less",
	stickyScroll: {
		enabled: true,
		maxLineCount: 5
	},

});
Reproduction Steps

Scroll down

Actual (Problematic) Behavior

It only/barely sticks 1 of the lines #id-4

Expected Behavior

Each id/class should be sticked as it does in vscode app + vscode.dev (works in both)

Additional Context

This bug was fixed earlier for language javascript? See issue #3565. Thanks for that @hediet!

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

Start with the linked Monaco Editor Playground reproduction and run the provided LESS example with stickyScroll enabled and maxLineCount set to 5. Compare the behavior with VS Code and vscode.dev, then review issue #3565 for the earlier JavaScript fix. Done means the nested IDs and classes remain sticky up to the configured line count.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.