monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Bug] "No suggestions." shown when suggestions are provided at end of current token

Open slztfn opened this issue 1 year ago • 3 comments

Reproducible in vscode.dev or in VS Code Desktop?

  • [X] 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.49.0#XQAAAAJTAwAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw4GI5RgmSaumWUF-TBOsVJ4S4FwfCDQb5-2uUHXTVAefbVSd9IzaZ_vv9VR9KugsKirq6H8R1sHX5qayINxsoff0wuywYId6sDsEfNAhivoMXmfLo3VYoGKrnFKqg0QpFSFviH8VIQzHmsC81P5EDM2y-7_NgUUxaeJJWPufd__bJN2aCQ_oVie_u5zVMD2jKACHAtVID4K-rhOe-rixeIsU6ydi2Amw4c0srV6DUXzn4bFLfn1CvC5lEipHbi0CShJSWaLxHokvh1aZhY_oTmy4VmvgNboGdVxq4I75ENgtr4hlFSzwU9SAENLyddXeM666y9HpNfbL6ZLbciuWPVxu_k_6xKkbumgcCf1r-6KUuhlzlzSLnh93kpEkYMwFyTaWGzVcl2i9zXvm6b5hZnHSXZ5q6jVFey3gytCcR4_gxZuAKk3oVlJMqNQrqu5F_dQA_qimwh7f0yM7XSOHuzyJohwwFuMuiX9X9dAaIqQsAo2tN4DHUPcbdFMHIOTOR5Ax0PSJ5PsQ_eF8fkk2MWuUeW3ZajlvhHRPWXG-7qP94CVgA

Monaco Editor Playground Code

const value = /* set from `myEditor.getModel()`: */ `select *
from dd
where a = dd -- no suggestions shown if cursor at end of dd
or a = '89' -- no suggestions shown if cursor is after 9`;


monaco.languages.registerCompletionItemProvider("sql", {
	provideCompletionItems: () => {
		return {
			suggestions: [{
				label: 'aaa89aa',
				insertText: 'aaa89aa',
				filterText: 'aaa89aa',
				kind: monaco.languages.CompletionItemKind["Keyword"],
				range: undefined,
			},{
				label: '::',
				insertText: '::',
				kind: monaco.languages.CompletionItemKind["Keyword"],
				range: undefined,
			}]
		}
	}
})
// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "sql",
	automaticLayout: true,
});

Reproduction Steps

place cursor at end of tokens as described and press Ctrl+Enter to trigger suggestions

Actual (Problematic) Behavior

"No suggestions." is shown

image image

Expected Behavior

Show the provided suggestions

image

Additional Context

No response

slztfn avatar Jun 10 '24 08:06 slztfn

I also experience this issue. Very annoying! and can't find a way to fix it :( version 0.37.1

mikhail-fedosenko avatar May 30 '25 14:05 mikhail-fedosenko

I'm not sure I understand the original problem. Why are results expected to show up with the '89'? Due to fuzzy matching?

@mikhail-fedosenko Do you have a different playground example?

rcjsuen avatar May 30 '25 14:05 rcjsuen

@rcjsuen no, i think because you invoke suggestions by a hot key...

Ok, i've tried an example with latest version and it worked... Will try to upgrade the lib in my project and test, because we have an ancient version of Monaco Editor.

mikhail-fedosenko avatar Jun 01 '25 10:06 mikhail-fedosenko