Skip to content

TS: duplicated imports in this case聽#57726

Description

Steps to Reproduce:

  1. in our sources have a TS file that uses import { watchFile } from 'fs';
  2. somewhere begin to use unwatchFile
  3. use quick fix to add import
  4. pick "Add import from 'fs'"

=> 馃悰 you get a second import

import { watchFile } from 'fs';
import { unwatchFile } from 'fs';

Activity

  1. removed their assignment
    on Mar 11, 2024
  2. navya9singh commented on Mar 11, 2024

    @navya9singh
    Member

    I'm working on a similar issue that duplicates import for 'move to file' and I tried to check if this is the same issue. However, the repro that I was trying out does not give me an error. Benjamin Pasero (@bpasero) please help me understand if this is similar to what you were trying out.
    This is what I tried:

    // @Filename: /a.ts
    export const t = 0;
    export const t2 = 0;
    
    // @Filename: /b.ts
    import {  t  } from "./a";
    
    const y = t + 1;
    const z = t2/**/ + 1;
    

    Used quick fix at /**/ to add import from "./a" and it resulted in import { t, t2 } from "./file1";

  3. bpasero commented on Mar 12, 2024

    @bpasero
    Author

    navya9singh my steps repro in the vscode sources if you open src/vs/platform/files/node/watcher/baseWatcher.ts and do the suggested change there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions