Incorrect positioning/Overlap for codelens in diff viewer
See original GitHub issueThere’s an overlap when we add a codelens to a line directly below a “removed code” block in the diff viewer (see screenshot). Ideally, the codelens should be in it’s own separate line (which is above the “removed code” block.

monaco-editor version: 0.30.1 Browser: Chrome 95.0.4638.69 (arm64) OS: macOS Playground code that reproduces the issue:
var originalModel = monaco.editor.createModel(
'This line is removed on the right.\nThis line is removed on the right.\nThis line is removed on the right.\njust some text\nabcd\nefgh\nSome more text',
'text/plain'
);
var modifiedModel = monaco.editor.createModel(
'This line is removed on the right.\nefgh\nSome more text',
'text/plain'
);
var diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'), {
readOnly: false,
automaticLayout: true,
scrollBeyondLastLine: false,
wordWrap: "on",
codeLens: true,
diffCodeLens: true,
originalEditable: true,
lineNumbersMinChars: 7,
});
diffEditor.setModel({
original: originalModel,
modified: modifiedModel
});
var commandId = diffEditor.addCommand(
0,
function () {
alert('my command is executing!');
},
''
);
monaco.languages.registerCodeLensProvider('*', {
provideCodeLenses: function (model, token) {
return {
lenses: [
{
range: {
startLineNumber: 2,
startColumn: 1,
endLineNumber: 2,
endColumn: 2
},
id: 'First Line',
command: {
id: commandId,
title: 'First Line'
}
}
],
dispose: () => {}
};
},
resolveCodeLens: function (model, codeLens, token) {
return codeLens;
}
});
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Incorrect positioning/Overlap for codelens in diff viewer
Steps to Reproduce: Clone the repo and run the extension with VS Code. Paste some content into the changes file such that you...
Read more >Put a codeLens overlay sticking in the end of the line
Placing the overlays on top won't have the problems described in the post(although they wont be that compact) as long as they are...
Read more >F# CodeLens overlays with normal code
With F# CodeLens enabled and set to be “above the line”, sometimes the type annotations appear at the same line – i.e. overlay...
Read more >Diff - 641242d23425443c46dc674504ce8dd47467cf9d^1.. ...
On a Unix system, you can do that by +cloning the `nvim-lspconfig` repository into the correct directory: + +```sh +dir="${HOME}/.local/share/nvim/site/pack/ ...
Read more >CodeLens not showing references - visual studio
Go back into Tools -> Options... -> Text Editor -> All Languages -> CodeLens. Check the "Enable CodeLens" option and click OK. Note:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@hediet Created an issue here, thanks!
Let’s track this issue in the vscode repo.