microsoft / microsoft/TypeScript

auto import build-in node module with protocol prefix

Open
#55,051 0 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Domain: LS: Auto-import Suggestion
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

Currently vscode will auto import build-in node module without node: prefix unless there is already another import with prefix.

Example:

No imports or one or more imports without node: prefix:

2023-07-16_05-58-56

One or more import with node: prefix:

2023-07-16_05-59-14

I would like to have a setting to force node: prefix.

Related:

https://github.com/eslint-community/eslint-plugin-n/issues/77
https://github.com/import-js/eslint-plugin-import/issues/2717

Workarounds:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named in the issue. Start by reproducing the auto-import behavior in VS Code with built-in Node modules, then trace the TypeScript language-service path that chooses the import form. Done means a setting can consistently force the node: prefix without depending on existing imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.