Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import named Disposable is not moved when moving code to another file #59799

Closed
alexdima opened this issue Aug 29, 2024 · 3 comments · Fixed by #60450
Closed

Import named Disposable is not moved when moving code to another file #59799

alexdima opened this issue Aug 29, 2024 · 3 comments · Fixed by #60450
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@alexdima
Copy link
Member

// @filename: src/_producer.ts
export class Disposable {}
// @filename: src/_consumer.ts
import { Disposable } from './_producer';

class Something extends Disposable {
}

Doing move to a new file on Something generates the following 🐛 (note how Disposable is not imported from _producer.ts):

// @filename: src/Something.ts
class Something extends Disposable {
}
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Aug 30, 2024
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 5.7.0 milestone Aug 30, 2024
@typescript-bot typescript-bot added Fix Available A PR has been opened for this issue labels Sep 7, 2024
@iisaduan
Copy link
Member

iisaduan commented Sep 7, 2024

Was this found in vscode, and if so, could you link the/a location in the repo where this happens? Currently, with the reported case, the import is correctly generated (#59884).

My guess is that this behavior is related to the autoImportFileExcludePatterns setting. I fixed a related crash few months ago (#58537), and the default case, if we could not find a non-excluded file to import from, was to finish the rest of the codefix without generating that particular import.

@iisaduan iisaduan removed the Fix Available A PR has been opened for this issue label Sep 7, 2024
@iisaduan iisaduan added the Needs More Info The issue still hasn't been fully clarified label Oct 3, 2024
@alexdima
Copy link
Member Author

alexdima commented Oct 4, 2024

Appologies for the slow reply. I'm really sorry, I spent 20 minutes trying to reproduce in a separate project than vscode, but I did not manage (I tried bringing over the tsconfig from vscode, the settings from the vscode folder, but to no avail).

Here are the steps:

  • clone https://github.com/microsoft/vscode
  • npm i
  • open vscode insiders Version: 1.95.0-insider / Commit: c33745f66ce1cd626c3282112671e2a66471ce4f / Date: 2024-10-04T05:03:41.673Z (4 hrs ago)
  • (this will use TS version 5.7.0-dev.20240927)
  • open src/vs/workbench/contrib/chat/browser/chatEditingService.ts#L338
  • move ChatEditingSession to a new file
Kapture.2024-10-04.at.11.51.48.mp4

@iisaduan
Copy link
Member

iisaduan commented Oct 7, 2024

This looks like a name resolving bug, thanks for providing the repo location!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
4 participants