aqua icon indicating copy to clipboard operation
aqua copied to clipboard

Detect imports like `import @fluencelabs/registry/...` and suggest users to `npm i -g @fluencelabs/registry`

Open folex opened this issue 2 years ago • 0 comments

It's a good UX to provide actionable suggestions to fix the problem.

In case of missing imports, we could try to detect if it's an import from some library, and suggest to install it via npm.

However, there's a problem of detection, consider:

import "protocols/ipfs/ipfs.aqua"
import "@protocols/ipfs/ipfs.aqua"
import "nice-library/awesomeness.aqua"
import "@fluencelabs/registry/api.aqua"

Which one is referring to NPM package and which one isn't? I see several ways to approach this:

  1. Hard-code @fluencelabs prefix and show suggestions only for these libraries2.
  2. Suggest blindly. e.g., npm i -g protocols @protocols/ipfs nice-library @fluencelabs/registry
  3. Check if library exists on NPM. For the example above, would have to check protocols, @protocols/ipfs, nice-library, @fluencelabs/registry. A lot of checks.

folex avatar Mar 30 '22 11:03 folex