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

Feat: Quick Fix: Extract to import map #997

Open
marvinhagemeister opened this issue Nov 28, 2023 · 1 comment
Open

Feat: Quick Fix: Extract to import map #997

marvinhagemeister opened this issue Nov 28, 2023 · 1 comment

Comments

@marvinhagemeister
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I find myself often in the situation where I'm prototyping something and using npm: or https:// imports for convenience. Once a dependency needs to be shared among files I typically want to move them to a single place to version them. So far I've always manually pasted and replaced the identifier, but I feel like it's something vscode should be able to do for me.

Describe the solution you'd like

A new quick fix command for npm: or https:// import specifiers that extracts it to the import map.

// Before
import { render } from "npm:preact@10.19.2";

// After
import { render } from "preact";

// deno.json
{
  "imports": {
    "preact": "npm:preact@10.19.2",
  }
}
@guy-borderless
Copy link

I want this for a while! Also perhaps handle other files with the same import (or similar import with a different version) via some code-action. This could help make the whole codebase nicer quickly.

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

2 participants