microsoft / microsoft/monaco-editor
[Bug] Update Inlay Hints Provider Example to use `paddingRight` and `paddingLeft`
Open
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
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
- Load the
Inlay Hints Provider Example - Note that the
whitespaceBeforeandwhitespaceAfterproperties do not affect the result - Change to
paddingLeftandpaddingRightand see impact
Actual (Problematic) Behavior
- Note that the
whitespaceBeforeandwhitespaceAfterproperties do not affect the result
Expected Behavior
Example should use correct properties
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 Inlay Hints Provider Example and its Monaco Editor Playground reproduction. Compare the example's whitespaceBefore and whitespaceAfter properties with the documented paddingLeft and paddingRight behavior; it is done when the example uses the correct properties and the playground reproduces the expected padding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100