microsoft / microsoft/monaco-editor
[Bug] setModelMarkers() with MarkerSeverity.Hint only underlines the first letter, regardless of the endColumn value
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?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
monaco.languages.register({ id: 'myLanguage' });
monaco.editor.onDidCreateModel(function(model) {
var markers = [
{
severity: monaco.MarkerSeverity.Hint,
startLineNumber: 1,
startColumn: 1,
endLineNumber: 1,
endColumn: 20,
message: 'test hint'
},
{
severity: monaco.MarkerSeverity.Info,
startLineNumber: 2,
startColumn: 1,
endLineNumber: 2,
endColumn: 20,
message: 'test info'
},
{
severity: monaco.MarkerSeverity.Warning,
startLineNumber: 3,
startColumn: 1,
endLineNumber: 3,
endColumn: 20,
message: 'test warning'
},
{
severity: monaco.MarkerSeverity.Error,
startLineNumber: 4,
startColumn: 1,
endLineNumber: 4,
endColumn: 20,
message: 'test error'
},
];
monaco.editor.setModelMarkers(model, 'myLanguage', markers);
});
var ed = monaco.editor.create(document.getElementById("container"), {
value: "this is a hint test\nthis is an info test\nthis is a warning test\nthis is an error test\n\n",
language: "myLanguage",
});
Reproduction Steps
After creating a Monaco editor with non-empty text, use setModelMarkers() to apply some markers, where at least one marker has MarkerSeverity.Hint and a "length" >1 (a.k.a. an endColumn value much higher than startColumn).
Actual (Problematic) Behavior
Any marker with MarkerSeverity.Hint will only underline a single letter, even if its startColumn and endColumn values imply it should underline several letters. The other three MarkerSeverities correctly underline multiple letters.
Expected Behavior
All MarkerSeverities underline multiple letters when asked to.
Additional Context
I have no idea how to attempt reproducing this in vscode.dev or VS Code Desktop, but Github is forcing me to check that box anyway.
If this is intended behavior, then it's not documented on any of:
https://microsoft.github.io/monaco-editor/typedoc/functions/editor.setModelMarkers.html
https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.IMarkerData.html
https://microsoft.github.io/monaco-editor/typedoc/enums/MarkerSeverity.html
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Monaco Editor Playground reproduction and run the setModelMarkers() example comparing Hint with Info, Warning, and Error. Trace the setModelMarkers() entry point to determine why Hint ignores the requested endColumn; done when Hint underlines the full requested span like the other severities.
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
- 45/100