question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect positioning/Overlap for codelens in diff viewer

See original GitHub issue

There’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.

Screenshot 2021-11-22 at 2 00 01 PM

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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dhruvit-rcommented, Nov 22, 2021

@hediet Created an issue here, thanks!

0reactions
hedietcommented, Nov 22, 2021

Let’s track this issue in the vscode repo.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found