microsoft / microsoft/monaco-editor
[Bug] Uncaught context cancellation error when using an inline provider
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 editor = monaco.editor.create(document.getElementById("container"), {
value,
language: "plaintext",
});
monaco.languages.registerInlineCompletionsProvider("plaintext", {
provideInlineCompletions(model, position, context, token) {
return {
items: [
{
insertText: "abc"
},
{
insertText: {
snippet: "var variable = \"${1:value}\""
}
}
]
};
},
freeInlineCompletions() {
}
});
Reproduction Steps
Browser: Google Chrome Version 131.0.6778.85 (Official Build) (arm64)
Operating System: macOS Sonoma 14.4
- Type
vin the preview editor. - The inline completion should appear.
- Hit the Tab key.
- An error will now appear in the browser console.
editor.main.js:52017 Uncaught (in promise) Canceled: Canceled
at UniqueContainer.value (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:52017:24)
at Emitter._deliver (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12271:26)
at Emitter.fire (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12300:22)
at MutableToken.cancel (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12686:35)
at CancellationTokenSource.cancel (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12733:29)
at Object.dispose (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12754:40)
at dispose (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:5534:27)
at DisposableStore.clear (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:5617:17)
at https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:22304:19
at https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:22297:17
Actual (Problematic) Behavior
Error appears in the browser console.
Expected Behavior
There should be nothing in the browser console.
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 Monaco Editor Playground link and the registerInlineCompletionsProvider example, then trace cancellation when Tab accepts an inline completion. Done means reproducing the case and seeing no uncaught Canceled error in the browser console.
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
- Clearly specified
- Newbie friendliness
- 45/100