Skip to content

Wrong dedupe on auto-import completions #19417

@cyrilletuzi

Description

@cyrilletuzi

TypeScript Version: 2.6.0-dev.20171019 and 2.7.0-dev.20171021
Tested in VS Code Insiders.

Following #7849 and microsoft/vscode#2635

Code

Install an Angular project :

npm install @angular/cli -g
ng new autoimport

Then in src/app/app.component.ts, add a new property and instantiate it with EventEmitter, using the new auto-import on completion :

export class AppComponent {
  title = 'app';
  test = new EventEmi // ...then choose from the completion list
}

Expected behavior:

Should be able to select the good class between the multiple ones available to have the good import :

import { Component, EventEmitter } from '@angular/core';

Actual behavior:

Problem is : several librairies export a class EventEmitter with the same name.

Currently, completion suggestions seem to be deduped, so just one is proposed, resulting in the wrong auto import :

import { EventEmitter } from 'events';

By the way, in case of multiple tokens with the same name, the completion list should display an information about the packages concerned, to be able to choose the good one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions