News for hackers. Stuff that matters.
Re:NPM and NodeJS should do more to make ES Modules easy to use by jeswin on Thursday June 20, 2024 @10:42AM (#40739284)
> I think that particular issue could be solved with tooling - if you can autocomplete from “package name” to a given exported identifier, you must already have a mapping from “package name” to “exported identifier” somewhere in your machine’s memory; duplicate this mapping and swap the keys for values, now “exported identifier” points to “package name” as well.

Sorry I don't follow. What the "from ..." syntax does (when typing it) is to narrow down 10k possibilities (the set of all exported functions in all in-scope modules) down to a few dozen. How would this be possible otherwise?

Illustration:

Case 1: import <just about anything is possible here - can't auto suggest>

Case 2: from fs import <only fs functions are in scope, start autosuggesting on keypress>

There are no comments on this comment yet.