TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

refactor: New file generates import from wrong module specifier

Open gsk143 opened this issue 1 year ago • 26 comments

Does this issue occur when all extensions are disabled?: Yes

Version: 1.90.0 (user setup) Commit: 89de5a8d4d6205e5b11647eb6a74844ca23d2573 Date: 2024-06-04T19:33:54.889Z Electron: 29.4.0 ElectronBuildId: 9593362 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.22631

Steps to Reproduce:

import prisma from "@/prisma/client";
import { NextRequest, NextResponse } from "next/server";
import { z } from "zod";

const createIssueSchema = z.object({
  title: z.string().min(1).max(255),
  description: z.string().min(1),
});

Try refactoring createIssueSchema variable to a new file 2024-06-12 09:20:14.898 [error] <semantic> TypeScript Server Error (5.5.0-dev.20240505) Debug Failure. Error: Debug Failure. at Object.addImportFromExportedSymbol (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:154711:32) at c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144661:19 at Map.forEach (<anonymous>) at addTargetFileImports (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144655:17) at getNewStatementsAndRemoveFromOldFile (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:143871:3) at doChange4 (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144853:3) at c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144842:77 at _ChangeTracker.with (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:174963:5) at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144842:60) at Object.getEditsForRefactor (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:142944:31) at Object.getEditsForRefactor2 [as getEditsForRefactor] (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:150350:32) at IpcIOSession.getEditsForRefactor (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:191692:49) at getEditsForRefactor (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:189914:43) at c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:192078:69 at IpcIOSession.executeWithRequestId (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:192070:14) at IpcIOSession.executeCommand (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:192078:29) at IpcIOSession.onMessage (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:192120:51) at process.<anonymous> (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\tsserver.js:528:14) at process.emit (node:events:514:28) at emit (node:internal/child_process:951:14) at process.processTicksAndRejections (node:internal/process/task_queues:83:21): Error: <semantic> TypeScript Server Error (5.5.0-dev.20240505) Debug Failure. Error: Debug Failure. at Object.addImportFromExportedSymbol (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:154711:32) at c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144661:19 at Map.forEach (<anonymous>) at addTargetFileImports (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144655:17) at getNewStatementsAndRemoveFromOldFile (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:143871:3) at doChange4 (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144853:3) at c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144842:77 at _ChangeTracker.with (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:174963:5) at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:144842:60) at Object.getEditsForRefactor (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:142944:31) at Object.getEditsForRefactor2 [as getEditsForRefactor] (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:150350:32) at IpcIOSession.getEditsForRefactor (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:191692:49) at getEditsForRefactor (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:189914:43) at c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:192078:69 at IpcIOSession.executeWithRequestId (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:192070:14) at IpcIOSession.executeCommand (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:192078:29) at IpcIOSession.onMessage (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\typescript.js:192120:51) at process.<anonymous> (c:\Users\ASUS\.vscode\extensions\ms-vscode.vscode-typescript-next-5.5.20240505\node_modules\typescript\lib\tsserver.js:528:14) at process.emit (node:events:514:28) at emit (node:internal/child_process:951:14) at process.processTicksAndRejections (node:internal/process/task_queues:83:21) at n.create (c:\Users\ASUS\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:473136) at v.dispatchResponse (c:\Users\ASUS\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:467106) at v.dispatchMessage (c:\Users\ASUS\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:465950) at ChildProcess.<anonymous> (c:\Users\ASUS\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:465443) at ChildProcess.emit (node:events:514:28) at emit (node:internal/child_process:951:14) at process.processTicksAndRejections (node:internal/process/task_queues:83:21) tsc version : 5.4.5

gsk143 avatar Jun 12 '24 03:06 gsk143

Doesn't seem to work when refactoring to an existing file either. I tried creating a new blank file manually and then refactoring to that file but VSCode ignores it.

Version info: image

leonsbuddydave avatar Jun 13 '24 22:06 leonsbuddydave

I'm having this problem in a Next.js project as well, is it specific to Next?

lemomar avatar Jul 06 '24 01:07 lemomar

Seems like the culprit is something in ^5.5 breaks refactoring imports from sym-linked packages.

Example (Works in v5.4.5 but not v5.5.2)

Running Refactor: Move to new file on SomeComponent correctly moves it and the Button import to SomeComponent.tsx, and updates the import in SomeOtherComponent.tsx to import { SomeComponent } from './SomeComponent'.

// apps/web/components/SomeOtherComponent.tsx

import { Button } from "@repo/ui";

export function SomeComponent() {
  return (
    <div>
      Some Component
      <Button>Click Me</Button>
    </div>
  );
}


export function SomeOtherComponent() {
  return (
    <div>
      <SomeComponent />
      <div>Some other component</div>
      <CheckList value={[]} options={[]} />
    </div>
  );
}


nolanleung avatar Jul 07 '24 01:07 nolanleung

I'm having this problem in a Next.js project as well, is it specific to Next?

No - It's caused by the typescript version you're using as commented by @nolanleung ealier

In your terminal:

  • npm i [email protected] -D
  • Then In your command pallette - TypeScript: Select TypeScript Version..
  • Choose 5.4.5

And try the command, you'll see that it works ✅

etiennejcharles avatar Jul 10 '24 15:07 etiennejcharles

I'm having this problem in a Next.js project as well, is it specific to Next?

No - It's caused by the typescript version you're using as commented by @nolanleung ealier

In your terminal:

  • npm i [email protected] -D
  • Then In your command pallette - TypeScript: Select TypeScript Version..
  • Choose 5.4.5

And try the command, you'll see that it works ✅

this fixed my issue. for anyone else

Error: <semantic> TypeScript Server Error (5.5.2)
Debug Failure. False expression.
Error: Debug Failure. False expression.
    at getCompletionEntryCodeActionsAndSourceDisplay

i was getting this error when attempting to autoimport certain things. TS server logs showed this

Info 908 [17:52:51.447] response: {"seq":0,"type":"response","command":"getCodeFixes","request_seq":64,"success":true,"body":[{"fixName":"import","description":"Add import from \"@tanstack/react-table\"","changes":[{"fileName":"[redacted]/column-select-button.tsx","textChanges":[{"start":{"line":3,"offset":1},"end":{"line":3,"offset":1},"newText":"import type { Table } from \"@tanstack/react-table\";\n"}]}]}]}

but it wouldn't actually add any text to my file, even though it showed the correct autoimport in the list.

which means the error was not from TS server? But instead from vscode? Just posting this incase it helps anyone

corned-beefhash avatar Jul 20 '24 01:07 corned-beefhash

Also really annoying that the Move to file and Move to new file has been swapped. I've been using Move to new file for years in the first position, why swap it?

divmgl avatar Jul 22 '24 16:07 divmgl

This really screwed up my flow for about to days, downgrading helped. see https://github.com/microsoft/TypeScript/issues/58897#issuecomment-2220808697

anback avatar Aug 03 '24 02:08 anback

  • TypeScript: Select TypeScript Version

This worked for me! Typescript version 5.4.5

Ife-Ody avatar Aug 08 '24 18:08 Ife-Ody

In your terminal:

* `npm i [email protected] -D`

* Then In your command pallette - `TypeScript: Select TypeScript Version..`

* Choose `5.4.5`

And try the command, you'll see that it works ✅

It works for me. If someone just faced with this problem - use this workaround

vitonsky avatar Aug 10 '24 12:08 vitonsky

Does not work for me unfortunately. I added

"typescript.tsdk": "/Users/simon/.nvm/versions/node/v21.5.0/lib/node_modules/typescript/lib",

as per the docs

output error when moving a Type declaration to a type.ts file.

<semantic> TypeScript Server Error (5.4.5) Debug Failure. False expression: No interactive refactor arguments available Error: Debug Failure. False expression: No interactive refactor arguments available at Object.getRefactorEditsToMoveToFile [as getEditsForAction]
(/Users/simon/.nvm/versions/node/v21.5.0/lib/node_modules/typescript/lib/tsserver.js:140862:11) at Object.getEditsForRefactor
(/Users/simon/.nvm/versions/node/v21.5.0/lib/node_modules/typescript/lib/tsserver.js:139733:31) at getEditsForRefactor2 (/Users/simon/.nvm/versions/node/v21.5.0/lib/node_modules/typescript/lib/tsserver.js:147297:32) at /Users/simon/.vscode/extensions/astro-build.astro-vscode-2.13.3-darwin-arm64/node_modules/astro-ts-plugin-bundle/index.js:5:1884 at Proxy.
<anonymous> (/Users/simon/.vscode/extensions/vue.volar-2.0.28/node_modules/typescript-vue-plugin-bundle/index.js:5:1894) at IpcIOSession.getEditsForRefactor (/Users/simon/.nvm/versions/node/v21.5.0/lib/node_modules/typescript/l...

sidouglas avatar Aug 14 '24 03:08 sidouglas

@sidouglas i guess in your case @vue/typescript-plugin plugin is the issue. I've had the same problem, and when I removed this plugin the refactor worked

KostkaBrukowa avatar Aug 19 '24 08:08 KostkaBrukowa

The workaround unfortunately doesn't work as smoothly if you don't have a node_modules in the current workspace root, i.e., if you have a monorepo with another sub folder.

I also tried the nightly version (via extension typescript nightly) 5.7 and it's broken too. If I do move to file I at the very minimum least see an error. But trying to move to a new file anything bigger than a constant number fails.

rsxdalv avatar Sep 10 '24 17:09 rsxdalv

This was also happening to me due to the default VSCode version of TS, even though I was working without typescript on a js file. Doing the steps above and then changing the tsdk version fixed it for me

goncalossantos avatar Sep 12 '24 10:09 goncalossantos

Minimal repro:

/// <reference path='fourslash.ts' />

// @Filename: /node_modules/zod/types.d.ts
//// declare const objectType: () => {};
//// 
//// export { objectType as object };

// @Filename: /node_modules/zod/external.d.ts
//// export * from "./types";

// @Filename: /node_modules/zod/index.d.ts
//// import * as z from "./external";
//// export * from "./external";
//// export { z };
//// export default z;

// @Filename: /test.ts
//// import { z } from "zod";
//// 
//// [|const createIssueSchema = z.object();|]

verify.moveToNewFile({
    newFileContents: {
        "/test.ts":
`
`,

        "/createIssueSchema.ts":
`import { z } from "zod";


const createIssueSchema = z.object();
`,
    },
});

MoveToNewFile should stop crashing after microsoft/vscode#60333, but the minimal repro will generate that z is imported from zod/external instead of just z

iisaduan avatar Oct 24 '24 00:10 iisaduan

  • Then In your command pallette - TypeScript: Select TypeScript Version..

For those like me that don't understand why they don't have the entry showing up in their command palette, your focused tab has to be a .ts(x) file.

laugri avatar Nov 12 '24 08:11 laugri

  • Then In your command pallette - TypeScript: Select TypeScript Version..

For those like me that don't understand why they don't have the entry showing up in their command palette, your focused tab has to be a .ts(x) file.

This is another problem, I use "restart ts server" a lot, since problems with ts server can not auto recover, I have to manual restart. I have to open a ts/tsx file then use the command palette to restart. why not showing these entries for whole workspace if ts server is running ? @The Team ???

magicdawn avatar Nov 20 '24 08:11 magicdawn

"move to file" / "move to new file" still not working on TypeScript v5.5 v5.6 & latest v5.7.2

Image


"move" works on v5.4, but TS v5.5 Inferred Type Predicates is really awesome, Can't leave this.

magicdawn avatar Nov 24 '24 09:11 magicdawn

@magicdawn since your crash still happens on 5.7, will you open a new issue with your repro? The case originally reported in this thread should no longer crash in 5.7, and I'd need to investigate your case separately

iisaduan avatar Nov 25 '24 17:11 iisaduan

Putting this here for others, but I "resolved" this by realizing my own error. Granted, I do wish some kind of notification would have informed me of it... My code (example):

function nonExportedFunction() {}

export function exportedFunction() {
  return nonExportedFunction()
}

Trying to move exportedFunction to a new file does nothing because, I assume, it doesn't want to just go and automatically export my nonExportedFunction so that the newly isolted exportedFunction() can import it.

Exported it myself, then "Move to new file" worked as expected ¯\_(ツ)_/¯

aaronmw avatar Mar 19 '25 15:03 aaronmw

@aaronmw Your case seems to be a bug with a different cause, since it is a case that should work by generating export in front of function nonExportedFunction() {} when you invoke move to new file. Can you file a new issue with some more info about your case?

iisaduan avatar Mar 19 '25 20:03 iisaduan

There's definitely still an issue here in 5.7.3

2025-04-24 13:30:06.682 [error] Error: <semantic> TypeScript Server Error (5.7.3)
Debug Failure. False expression: Expected symbol to be a module
Error: Debug Failure. False expression: Expected symbol to be a module
    at Object.addImportForModuleSymbol (/Users/lukeramsden/workspace/architect/node_modules/typescript/lib/typescript.js:156990:11)
    at /Users/lukeramsden/workspace/architect/node_modules/typescript/lib/typescript.js:146715:19
    at Map.forEach (<anonymous>)
    at addTargetFileImports (/Users/lukeramsden/workspace/architect/node_modules/typescript/lib/typescript.js:146708:17)

lukeramsden avatar Apr 24 '25 12:04 lukeramsden

issue persists on typescript 5.9.0: https://github.com/microsoft/TypeScript/issues/61632

scarf005 avatar Apr 29 '25 02:04 scarf005

It's present in typescript@latest (5.8.3)

<semantic> TypeScript Server Error (5.8.3)
Debug Failure. False expression: Expected symbol to be a module
Error: Debug Failure. False expression: Expected symbol to be a module
    at Object.addImportForModuleSymbol (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:157416:11)
    at /usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:147140:19
    at Map.forEach (<anonymous>)
    at addTargetFileImports (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:147133:17)
    at getNewStatementsAndRemoveFromOldFile (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:146364:3)
    at doChange3 (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:146348:3)
    at /usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:146333:79
    at _ChangeTracker.with (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:178070:5)
    at Object.getRefactorEditsToMoveToFile [as getEditsForAction] (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:146333:62)
    at Object.getEditsForRefactor (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:145454:31)
    at Object.getEditsForRefactor2 [as getEditsForRefactor] (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:152954:32)
    at IpcIOSession.getEditsForRefactor (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:195255:49)
    at getEditsForRefactor (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:193406:43)
    at /usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:195676:15
    at IpcIOSession.executeWithRequestId (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:195665:14)
    at IpcIOSession.executeCommand (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:195674:29)
    at IpcIOSession.onMessage (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/typescript.js:195722:68)
    at process.<anonymous> (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/_tsserver.js:519:14)
    at process.emit (node:events:524:28)
    at emit (node:internal/child_process:950:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

vscode version:

Version: 1.100.2
Commit: 848b80aeb52026648a8ff9f7c45a9b0a80641e2e
Date: 2025-05-14T21:47:40.416Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Linux x64 6.12.22+bpo-amd64

ionutcatana avatar May 22 '25 11:05 ionutcatana

Still present in Typescript v5.8.2 and v5.8.3

ERR <semantic> TypeScript Server Error (5.8.2)
Debug Failure. False expression: Expected symbol to be a module
Error: Debug Failure. False expression: Expected symbol to be a module
    at Object.addImportForModuleSymbol (/node_modules/typescript/lib/typescript.js:157416:11)
    at /node_modules/typescript/lib/typescript.js:147140:19
    at Map.forEach (<anonymous>)
    at addTargetFileImports (/node_modules/typescript/lib/typescript.js:147133:17)
    at getNewStatementsAndRemoveFromOldFile (/node_modules/typescript/lib/typescript.js:146364:3)
    at doChange4 (/node_modules/typescript/lib/typescript.js:147360:3)
    at /node_modules/typescript/lib/typescript.js:147349:77
    at _ChangeTracker.with (/node_modules/typescript/lib/typescript.js:178070:5)
    at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (/node_modules/typescript/lib/typescript.js:147349:60)
    at Object.getEditsForRefactor (/node_modules/typescript/lib/typescript.js:145454:31)
    at Object.getEditsForRefactor2 [as getEditsForRefactor] (/node_modules/typescript/lib/typescript.js:152954:32)
    at IpcIOSession.getEditsForRefactor (/node_modules/typescript/lib/typescript.js:195255:49)
    at getEditsForRefactor (/node_modules/typescript/lib/typescript.js:193406:43)
    at /node_modules/typescript/lib/typescript.js:195676:15
    at IpcIOSession.executeWithRequestId (/node_modules/typescript/lib/typescript.js:195665:14)
    at IpcIOSession.executeCommand (/node_modules/typescript/lib/typescript.js:195674:29)
    at IpcIOSession.onMessage (/node_modules/typescript/lib/typescript.js:195722:68)
    at process.<anonymous> (/node_modules/typescript/lib/_tsserver.js:519:14)
    at process.emit (node:events:524:28)
    at emit (node:internal/child_process:950:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21): Error: <semantic> TypeScript Server Error (5.8.2)
Debug Failure. False expression: Expected symbol to be a module
Error: Debug Failure. False expression: Expected symbol to be a module
    at Object.addImportForModuleSymbol (/node_modules/typescript/lib/typescript.js:157416:11)
    at /node_modules/typescript/lib/typescript.js:147140:19
    at Map.forEach (<anonymous>)
    at addTargetFileImports (/node_modules/typescript/lib/typescript.js:147133:17)
    at getNewStatementsAndRemoveFromOldFile (/node_modules/typescript/lib/typescript.js:146364:3)
    at doChange4 (/node_modules/typescript/lib/typescript.js:147360:3)
    at /node_modules/typescript/lib/typescript.js:147349:77
    at _ChangeTracker.with (/node_modules/typescript/lib/typescript.js:178070:5)
    at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (/node_modules/typescript/lib/typescript.js:147349:60)
    at Object.getEditsForRefactor (/node_modules/typescript/lib/typescript.js:145454:31)
    at Object.getEditsForRefactor2 [as getEditsForRefactor] (/node_modules/typescript/lib/typescript.js:152954:32)
    at IpcIOSession.getEditsForRefactor (/node_modules/typescript/lib/typescript.js:195255:49)
    at getEditsForRefactor (/node_modules/typescript/lib/typescript.js:193406:43)
    at /node_modules/typescript/lib/typescript.js:195676:15
    at IpcIOSession.executeWithRequestId (/node_modules/typescript/lib/typescript.js:195665:14)
    at IpcIOSession.executeCommand (/node_modules/typescript/lib/typescript.js:195674:29)
    at IpcIOSession.onMessage (/node_modules/typescript/lib/typescript.js:195722:68)
    at process.<anonymous> (/node_modules/typescript/lib/_tsserver.js:519:14)
    at process.emit (node:events:524:28)
    at emit (node:internal/child_process:950:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
    at Function.create (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:2:496515)
    at y.dispatchResponse (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:2:490107)
    at y.dispatchMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:2:488548)
    at ChildProcess.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:2:488041)
    at ChildProcess.emit (node:events:524:28)
    at ChildProcess.emit (node:domain:489:12)
    at emit (node:internal/child_process:950:14)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
code --version
1.100.2
848b80aeb52026648a8ff9f7c45a9b0a80641e2e
arm64

xmonkee avatar May 30 '25 19:05 xmonkee

@lukeramsden @ionutcatana @xmonkee Just from the stack trace, it seems like your cases have a different cause than the original bug in this issue. In order for us to investigate more, could you make a new issue with a repro?

iisaduan avatar Jun 02 '25 15:06 iisaduan

Can confirm seeing this on v5.8.3 as well

Cpt-Falcon avatar Jun 11 '25 16:06 Cpt-Falcon