saem / vscode-nim

Other
180 stars 23 forks source link

autocompletion requires the module to be imported #95

Closed jcornaz closed 2 years ago

jcornaz commented 2 years ago

Hi,

The autocompletion does not suggest what is not already imported.

I would expect to see autocompletion even for stuff that is not yet imported, and if I accept the suggestion, it should add the import.

saem commented 2 years ago

That's not how nimsuggest (the compiler) works. The list of symbols that aren't in scope aren't suggested. That precludes adding them in and consequently adding in the import.

There are other complications as one could be inside a top level when block and it's unclear where the import should be auto-added.

I did want to add this a while back but it was edge case after edge case. We have a symbol index that we might be able to leverage but there could well be other issues such as dealing with existing import except or import from etc.

If you want to take a stab at implementing it you can reopen this issue, otherwise I'm afraid it's not feasible.

jcornaz commented 2 years ago

Ok. That's a shame. But thank you for the quick answer.