microsoft / microsoft/TypeScript

Provide better displays for paths when not fully resolved

Open
#45,494 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: LS: Auto-import Domain: LS: Completion Lists In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

In https://github.com/microsoft/TypeScript/pull/44713, we started to do partial resolutions of paths for auto-import completions. This is great, however, it would be nice if we could do a small amount of work for common cases just to clean up paths that go through node_modules even without further keystrokes.

  • In cases where the resolution strategy is node and there are no path mappings, we could try to rewrite some number of dotted segments, followed by node_modules into package_name/... until fully resolved.
  • In other cases, we could even just use containingFolderName/filename

Of course, there are risks here since in JS, string math isn't always cheap. In cases where you have hundreds of thousands of auto-imports from node_modules, this could still get expensive.

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

Start by tracing the partial path-resolution logic introduced in PR #44713 for auto-import completions, focusing on node_modules and node resolution cases. Compare the proposed package_name/... and containingFolderName/filename displays, and verify that the result remains affordable for large node_modules completion sets.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.