-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I would like to pass suggestion keys for Auto completion to the code editor.
I would need to pass the suggestion keys to the on_mount parameter.
something like this in javascript
const handleEditorMount = (editor, monaco) => {
// Set up custom autocompletion
monaco.languages.registerCompletionItemProvider('javascript', {
provideCompletionItems: (model, position) => {
// Your custom autocompletion logic
const suggestions = [
{
label: 'customMethod',
kind: monaco.languages.CompletionItemKind.Method,
insertText: 'customMethod(${1:parameter})',
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
documentation: 'A custom method for autocompletion'
}
];
return { suggestions };
}
});
};
return (
<Editor
height="400px"
defaultLanguage="javascript"
onMount={handleEditorMount}
/>
);
If you will be able to help I would really appreciate it.
Metadata
Metadata
Assignees
Labels
No labels