microsoft / microsoft/monaco-editor

[Bug] Tab only accept the empty space

Open
#4,452 4 comments 0 reactions 0 assignees View on GitHub

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?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.47.0#XQAAAAJQAgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw1r3sCnGBGpWlpVktocO7_BJCkQTDFxvol36GvVmJLcE84C3knSa45xr2hL4V3CzK7RsXTTl3GKNcoe1EOluseUOqlAiRzt565Aikzvea61xWU_C6O4O4af9d95Ho8N37E04AP_F4QgtoH62aRToKkEAPJZoSsZZfAcW23V_8iVY6IVDJixX7Qj5iTFcYx3oLLpyOrtWl5zCHbN-ayZrwUeHldP8jznwshtDv_rgKRk-aCws0DDW2EPOv5b5f_xemFBnpV9OH_7CG5c1Z7OsTHfGIu7oi9k30gjuf2n26CCHN7kRQ-Sye4CP3wTY_3KIXJzrmOTR4TMCrfTPmM8Oi2diYm4dP9RHHrmilKrj-bUnY

Monaco Editor Playground Code
monaco.languages.registerInlineCompletionsProvider("sql", {
	provideInlineCompletions: function (model, position, context, token) {
		console.log('Provide new completion', position, context, token)
		return {items: [
                    {
                        insertText: '  buhao'
                    },
                ]};
	},
	freeInlineCompletions: function (completions) {
		console.log(completions);
	},
}); 

monaco.editor.create(document.getElementById("container"), {
	value: 'SELECT\n  *',
	language: "sql",
});
Reproduction Steps
  1. Open the playground
  2. Type an enter
  3. You will see ' buhao' suggested
  4. Tab
  5. You will see empty space accepted
Actual (Problematic) Behavior

Tab can only accept empty space

Expected Behavior

Tab accept the full suggestion

Additional Context

https://github.com/microsoft/monaco-editor/assets/109033553/81f3a38b-1bd9-4201-8034-3e3b6bcf6ed7

Try on 0.43,0.44,0.47, all don't work. Have to mention, sometimes it works, sometimes it doesn't. Not sure what's the pattern

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.

Research direction

Start with the Monaco Editor Playground link and the inline completions provider code in the issue. Reproduce the SQL example across the mentioned Monaco versions, focusing on how Tab handles the suggestion with leading spaces and the reported intermittent behavior. Done means Tab consistently accepts the full “ buhao” suggestion rather than only the empty space.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.