mokkabonna / inquirer-autocomplete-prompt

Autocomplete prompt for inquirer
ISC License
350 stars 82 forks source link

Does not work with inquirer.createPromptModule #146

Closed sargunv closed 1 year ago

sargunv commented 1 year ago

Environment

Symptom

The choices don't show up for selection when using this package with inquirer.createPromptModule. This means it's not possible to use this package while outputting to stderr instead of stdout. Standard inquirer types work fine (such as list, the closest equivalent to this available).

CleanShot 2022-10-20 at 12 46 29@2x

Repro

const inqurier = require("inquirer");
inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'));

// works
inquirer.prompt({ 'type': 'autocomplete', ... })

// does not work
const prompt1 = inquirer.createPromptModule({ output: stderr });
prompt1({ 'type': 'autocomplete', ... })

// also does not work
const prompt2 = inquirer.createPromptModule({});
prompt2({ 'type': 'autocomplete', ... })

// builtin list type works fine still
prompt1({ 'type': 'list', ... })
prompt2({ 'type': 'list', ... })
mokkabonna commented 1 year ago

As I understand createPromptModule is that it is separate from the default inquirer.

So you have to register the autocomplete prompt with the prompt1 or prompt2 module. See https://github.com/mokkabonna/inquirer-autocomplete-prompt/commit/3ee49870b82f3fad10f98c704839cf4b819f273a for an example

Seems to work as expected then.

sargunv commented 1 year ago

This makes sense. I'm no longer at the job where I was using this, so I unfortunately can't confirm 😅

Thanks for the info though, it'll be helpful next time I use this.

mokkabonna commented 1 year ago

Yeah sorry for the late reply. :)