Using tab key for autocomplete suggestions

Currently, we see auto-complete menu from code mirror. but when i press tab it doesnt add the selected suggestion to the editor. instead, a tab key is added to the text.

How can we enable tab auto completion for codemirror?

You could bind tab to acceptCompletion.

1 Like

thanks, it worked

Is there a good way to do this while also using the indentWithTab package?

Here’s my attempt which seems to work

keymap.of([
        {
          key: 'Tab',
          preventDefault: true,
          shift: indentLess,
          run: e => {
            if (!completionStatus(e.state)) return indentMore(e);
            return acceptCompletion(e);
          },
        },
      ])
1 Like

Hi!
… and how to do it? is there an example?