microsoft / microsoft/monaco-editor
[Bug] CodeLens. range.startColumn not take effect
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
var editor = monaco.editor.create(document.getElementById("container"), {
value: '{\n\t"dependencies": {\n\t\t\n\t}\n}\n',
language: "json",
});
var commandId = editor.addCommand(
0,
function () {
// services available in `ctx`
alert("my command is executing!");
},
""
);
monaco.languages.registerCodeLensProvider("json", {
provideCodeLenses: function (model, token) {
return {
lenses: [
{
range: {
startLineNumber: 1,
startColumn: 10,
endLineNumber: 1,
endColumn: 20,
},
id: "First Line",
command: {
id: commandId,
title: "First Line",
},
},
],
dispose: () => {},
};
},
resolveCodeLens: function (model, codeLens, token) {
return codeLens;
},
});
Reproduction Steps
- open the link
- past the code
Actual (Problematic) Behavior
the codelens always displays on the left top of the specified line, the endLineNumber, startColumn and endColumn do not take effect
Expected Behavior
I suppose it should be able to create inline codelens by specifying the startlinlNumber equal to endLineNumber and endColumn as content lens,
Additional Context
No response
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 its registerCodeLensProvider implementation, especially the supplied range values. Verify how CodeLens placement uses startLineNumber, endLineNumber, startColumn, and endColumn, then run the reproduction to confirm the expected inline placement and add or update coverage for the corrected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100