Skip to content

Suggestion Keys #2

@Ernelene

Description

@Ernelene

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions