microsoft / microsoft/monaco-editor
[Bug] Decorations cannot appear after inline completions
Open
Nobody has claimed this yet.
editor-core
feature-request
- 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 myEditor = monaco.editor.create(document.getElementById("container"), {
value: '{\n\t"dependencies": {\n\t\t\n\t}\n}\n',
language: "json",
});
monaco.languages.registerInlineCompletionsProvider("json", {
provideInlineCompletions: function (model, position, context, token) {
return {items: [{insertText: 'foo'}]};
},
freeInlineCompletions: function (completions) {
},
handleItemDidShow: function (completions, item, updatedInsertText) {
console.log("Item shown: ", item);
let range = {'startColumn': 0, 'endColumn': 100, 'startLineNumber': 3, 'endLineNumber': 3};
let decoration = {'range': range, 'options': {'after': {'content': 'bar'}}};
myEditor.deltaDecorations([], [decoration]);
}
});
Reproduction Steps
- Go to line 3
- Hit space to trigger an inline completion
- The inline completion "foo" and the decoration "bar" both appear
Actual (Problematic) Behavior
The decoration "bar" appears before the inline suggestion "foo" despite the decoration having an endColumn of 100
Expected Behavior
I expect the decoration to appear after the inline suggestion
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 linked Monaco Editor playground and its inline completions provider, reproducing the interaction between the inline suggestion and the after decoration. Trace how inline completions and decorations are positioned together; done means the decoration appears after the inline suggestion in the supplied reproduction without regressing normal decoration placement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100