Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab complete throws TypeError exception #7

Open
jordanranz opened this issue Apr 2, 2019 · 0 comments
Open

Tab complete throws TypeError exception #7

jordanranz opened this issue Apr 2, 2019 · 0 comments

Comments

@jordanranz
Copy link

Seeing an exception thrown when trying to do a tab complete on a path that in not in the rootPath.

const choice = Choices.prototype.getChoice.call(this.currentChoices, choiceIndex);

TypeError: Cannot read property 'value' of undefined at module.exports.currentChoices.getChoice (/Users/jranz/amplify/amplify-cli/packages/amplify-category-xr/node_modules/inquirer-fuzzy-path/index.js:89:35) at InquirerFuzzyPath.Prompt.onKeypress (/Users/jranz/amplify/amplify-cli/packages/amplify-category-xr/node_modules/inquirer-autocomplete-prompt/index.js:217:29) ...

I tried adding a check for 'choice' returning:
if (!choice) { return { value: null, name: null, short: null } }

and I see a line in the autocomplete-prompt package also throws an exception:
https://github.com/mokkabonna/inquirer-autocomplete-prompt/blob/master/index.js#L215

TypeError: Cannot read property 'length' of null at InquirerFuzzyPath.Prompt.onKeypress (/Users/jranz/amplify/amplify-cli/packages/amplify-category-xr/node_modules/inquirer-autocomplete-prompt/index.js:221:61) ...

I am able to workaround this by checking if 'autoCompleted' is null and setting it to empty string.

I'll open a similar issue in the autocomplete package.

I really like this plugin, so let me know if I am either doing something incorrect or if I can help make the fix to improve this use case!

@jordanranz jordanranz changed the title Tab complete throws exception Tab complete throws TypeError exception Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant