Skip to content

Improve "suggestions show path" for "node_modules" #42005

Closed
@heroboy

Description

@heroboy

Search Terms

TypeScript suggestions show path
TypeScript can provide completions that also add an import statement. However, when there are multiple symbols with the same name, it is hard to pick the right completion. This release makes this simpler because paths of auto-import completions are shown with the label.

Suggestion

As description above. I think the path should be show as import form, not show path like 'node_modules/xxx/index' but 'xxx'
And sort it as the "show fixes" menu I post below.

Use Cases

Here is the current result

图片
It is not very easy to choose which one to import Table, because the path is too long and very same. (Actually I want the 3rd one, it is 'antd')


Here is the "show fixes" menu
图片
It is much more clear.


Here is the "show fixes" menu, when I already import something from 'antd'
图片

Examples

no example.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Assignees

Labels

Domain: Completion ListsThe issue relates to showing completion lists in an editorFix AvailableA PR has been opened for this issueIn DiscussionNot yet reached consensusRescheduledThis issue was previously scheduled to an earlier milestoneSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions