Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Update Inlay Hints Provider Example to use paddingRight and paddingLeft #4470

Open
1 of 2 tasks
byronwall opened this issue Apr 16, 2024 · 0 comments
Open
1 of 2 tasks

Comments

@byronwall
Copy link

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.47.0#XQAAAAJGBgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw_MnGRgmSaumWUF-TBOs7hVNPXc5Iv5vs3RB5mlylvG051-DfnCEgCN-B2M7mD076Fmw32M_5YJEJO_6SDm80o3ulryAn99D8wWHouPLBhxnXI-nTfrfb4M6Tvx1j_vvdMocHG4qGF_LhoF-kfEiDDlKrkbdX7NHwZw4JOUT-pUYc5dZzTI3QyhbZtCI9Wt3nWIGT0jkZIxqBVRM-vBEdnHl9AYl-KGGVBadSExWlgDbknOQ8MUr6NZ4GNyddUiVk6rArLzccBNHZDWuunilebIBnuu6lDsQNlUPmzSlMW-hQun7_ZS3c62WCQDQY4I1niLcF1I95_Onk13HpUlYYfUho-g6ZriRqtA06Sh-DGc8ZXul6UyNFcq3ulzJ8u75QPeoh8dIXdSORgnXJ6DwELj9Sha0ax3u61kn1O1L3PUZXmCSrh3KwZ06BVTYIn-cOTqjXPC5nCMvqWM2YMWwb26Jbegqty730sXqtMkY8XTUWVN8-zX-TldHgyqfuWolTswk1GeLjEIiwD9jsyQPKBlboOg8mhEDsexgIPVbyOYzsBqz_812Blg

Monaco Editor Playground Code

const value = `
const f = (a, b) => a + b;

const result = f(2, 5);
const result = f(2, 5);
`;

const editor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "javascript",
});

monaco.languages.registerInlayHintsProvider("javascript", {
	provideInlayHints(model, range, token) {
		return {
			hints: [
				{
					kind: monaco.languages.InlayHintKind.Type,
					position: { column: 13, lineNumber: 4 },
					label: `: Number`,
				},
				{
					kind: monaco.languages.InlayHintKind.Type,
					position: { column: 13, lineNumber: 5 },
					label: `: Number`,
				},
				{
					kind: monaco.languages.InlayHintKind.Type,
					position: { column: 13, lineNumber: 2 },
					label: `: Number`,
				},
				{
					kind: monaco.languages.InlayHintKind.Type,
					position: { column: 16, lineNumber: 2 },
					label: `: Number`,
				},
				
				{
					kind: monaco.languages.InlayHintKind.Parameter,
					position: { column: 18, lineNumber: 4 },
					label: `a:`,
				},
				{
					kind: monaco.languages.InlayHintKind.Parameter,
					position: { column: 21, lineNumber: 4 },
					label: `b:`,
					whitespaceAfter: true, // old parameter does not work anymore
				},
				{
					kind: monaco.languages.InlayHintKind.Parameter,
					position: { column: 18, lineNumber: 5 },
					label: `a:`,
				},
				{
					kind: monaco.languages.InlayHintKind.Parameter,
					position: { column: 21, lineNumber: 5 },
					label: `b:`,
					paddingRight: true, // paddingRight works
				},
			],
			dispose: () => {},
		};
	},
});

Reproduction Steps

  1. Load the Inlay Hints Provider Example
  2. Note that the whitespaceBefore and whitespaceAfter properties do not affect the result
  3. Change to paddingLeft and paddingRight and see impact

Actual (Problematic) Behavior

  1. Note that the whitespaceBefore and whitespaceAfter properties do not affect the result

Expected Behavior

Example should use correct properties

image

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant