microsoft / microsoft/monaco-editor

[Bug] Very first size calculation of resolved intellisense details is wrong (height not correct)

Open
#3,566 3 comments 0 reactions 1 assignee View on GitHub

@jrieken is already working on this.

Since Feb 16, 2023.

bug suggest
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.35.0#XQAAAAKYAwAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw4exyJ7XTDEjmw5QDdXTTvRIkASBA9r-aSiNRP7ZystzcFj6PAZLf9KKAlbffUcFembtuFiOkBQCpCNqWOg5S5oy-ZOK_8V-W3bfou7xUHyndToPsoeAXHqSqNyaC0CBLcEioF5PbypG63rcfJxKyiAhZ35UAhH8iopeba12fnGReesElaSIn_JJPw5jdFZX-Bd5FP6eEF1uET7PwOWHXEJrLzx6TwEMtiRdsRaxxRNd57btO9-adYOioW3BzFkigZF5uZcOTZ65wTXrl9mZWjzsyDLYcrdcczXrODmuYzDpTGbv4Kwv1WnqxD6nCX49jj9DAnOicvSr9ZsWZg7jstDWukvTDpsaZ-mecU5FjvHK1ecif53TZ0WiwqlR_Bh_3hRBY0XMsdLLJz8cUe6yJPY96U_0WqKuAau5rCe8S0VshpeXuIRR0z9DwZG82qMYpTBUXpUVCQIxZPTgEb4GV_DEAXn-cnfoXUfX5RZxWMelYG-6HgMESM3CUU9hMak32hvQ7WmpfNh8ojTQ78k3zMsHrjy1NIiPwTjKfp2D0_qbbb3bA_fC8uiNCWLy-Gf9dLvgA

Monaco Editor Playground Code
monaco.languages.registerCompletionItemProvider('csharp', {
	provideCompletionItems: (model, position, context, token) => {
		var word = model.getWordUntilPosition(position);

		return {
			suggestions: [
				{
					label: 'Method',
					kind: monaco.languages.CompletionItemKind.Method,
					insertText: 'Method',
					detail: 'void Method(int i, int j, int k, int l, int m, int n, int o)',
					documentation: {
						value: 'Documentation1\n\nDocumentation2\n\nDocumentation3'
					},
					range: {
						startLineNumber: position.lineNumber,
						startColumn: word.startColumn,
						endLineNumber: position.lineNumber,
						endColumn: word.endColumn
					}
				}
			]
		};
	}
});

const editor = monaco.editor.create(document.getElementById('container'), {
	value: [
		'class Test',
		'{',
		'    ',
		'}'
	].join('\r\n'),
	language: 'csharp'
});
Reproduction Steps
  1. Put cursor in line 3
  2. press ctrl + space -> IntelliSense pops up
  3. press ctrl + space again -> details pop up => In the details you cannot see "Documentation3". It is cut off and the overlay has a vertical scrollbar
  4. press ctrl + space again -> details overlay closes
  5. press ctrl + space again -> details pop up with correct size ("Documentation3" is visible from the start without scrolling)
Actual (Problematic) Behavior

On the very first IntelliSense call after loading a fresh editor, the size calculation of the details is wrong (see reproduction example)

Expected Behavior

On the first IntelliSense call after loading a fresh editor, the size of the details overlay should be correctly calculated.

Additional Context

It only seems to happen, if the "detail" get word-wrapped to a new line. If "detail" is a one-liner, the size calculation is correct.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.