Monaco-editor by default provide suggestions based on the previously typed words on the editor. In order to get only the custom added suggestions, you can provide the suggestions through registerCompletionItemProvider and it will override any default suggestions provided by moncao-editor.
Example:
monaco.languages.registerCompletionItemProvider('myCustomLanguage', {
provideCompletionItems: function(model, position) {
const suggestions = [
{
label: 'console',
kind: monaco.languages.CompletionItemKind.Function,
documentation: 'Logs a message to the console.',
insertText: 'console.log()',
},
{
label: 'setTimeout',
kind: monaco.languages.CompletionItemKind.Function,
documentation: 'Executes a function after a specified time interval.',
insertText: 'setTimeout(() => {\n\n}, 1000)',
}
];
return { suggestions: suggestions };
}
});
If you type something now, it will not suggest anything that was earlier typed. On pressing Ctrl+Space, you would see only the above two suggestions("console" & "setTimeOut") on the editor.