yamaton / vscode-h2o

Add CLI autocomplete functionalities to Shell Script
MIT License
18 stars 1 forks source link

TypeError: Cannot read properties of null (reading 'concat') #8

Closed vdesabou closed 1 year ago

vdesabou commented 1 year ago

I was getting issue with sub-subcommand:

[Extension Host] [Completion] No completion item is available (1) TypeError: Cannot read properties of null (reading 'concat')
    at getOptions (/Users/vsaboulin/.vscode/extensions/tetradresearch.vscode-h2o-0.2.12/out/extension.js:558:40)
    at getCompletionsOptions (/Users/vsaboulin/.vscode/extensions/tetradresearch.vscode-h2o-0.2.12/out/extension.js:524:21)
    at Object.<anonymous> (/Users/vsaboulin/.vscode/extensions/tetradresearch.vscode-h2o-0.2.12/out/extension.js:66:47)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/vsaboulin/.vscode/extensions/tetradresearch.vscode-h2o-0.2.12/out/extension.js:5:58)

I fixed it by changing:

const options = deepestCmd.options.concat(...inheritedOptionsArray);

to

const options = (!!deepestCmd && !!deepestCmd.options) ? deepestCmd.options.concat(...inheritedOptionsArray) : [];

It's probably not the best code, but that seems to work in my case

yamaton commented 1 year ago

Thank you so much for your report and the fix! I've added it, and published as 0.2.13.

vdesabou commented 1 year ago

Works perfectly now !