这个问题在使用所有扩展都被禁用时是否会发生?:是的
- VS Code 版本:版本:1.92.1(通用)
- OS 版本:MacOS Sonoma 14.5 / Apple M1 Pro
重现步骤:
- 重构 > 移动到新文件
我已经尝试过的方法: - 使用
--disable-extensions
运行以确保它不是包的问题。 typescript.tsserver.enableTrace
- 寻找最小示例
- 搜索类似问题:Refactor: move to new file does not work vscode#51586,Refactor > Move to a new file -- not working (update, nothing in Refactor menu working) vscode#58711
在之前的几个版本中它可以正常工作。我不知道确切是哪个版本没问题。
更新:不起作用:
import { useLatest } from 'react-use';
export function useUseLatest (data: string) {
return useLatest(data);
}
不起作用:
import { selectStore, useSelector } from '@proterm/core';
export function useOrders() {
return useSelector(selectStore);
}
不起作用:
import { selectStore } from '@proterm/core';
export function useOrders() {
return selectStore;
}
起作用:
import { AnyBaseOrder } from '@terminal/scalp/types';
export function useOrders(symbolId: string): AnyBaseOrder[] {}
起作用:
import { useSelector } from 'react-redux';
function useOrders() {
return useSelector((state) => console.log(state));
}
起作用:
import { selectStore, useSelector } from '@proterm/core';
export function useOrders(symbolId: string): AnyBaseOrder[] {}
我认为 @ import aliases 是问题所在,但这个也可以:
import { FancyAlertCircleIcon } from '@terminal/icons';
export function useOrders() {
return FancyAlertCircleIcon;
}
错误:
2024-08-15 18:42:15.101 [error] <semantic> TypeScript Server Error (5.5.4)
Debug Failure.
Error: Debug Failure.
at Object.addImportFromExportedSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:154243:32)
at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:144288:19
at Map.forEach (<anonymous>)
at addTargetFileImports (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:144282:17)
at getNewStatementsAndRemoveFromOldFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:143512:3)
at doChange4 (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:144488:3)
at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:144477:77
at _ChangeTracker.with (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:174306:5)
at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:144477:60)
at Object.getEditsForRefactor (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:142603:31)
at Object.getEditsForRefactor2 [as getEditsForRefactor] (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:149939:32)
at IpcIOSession.getEditsForRefactor (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:191087:49)
at getEditsForRefactor (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:189305:43)
at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:191491:69
at IpcIOSession.executeWithRequestId (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:191483:14)
at IpcIOSession.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:191491:29)
at IpcIOSession.onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:191533:51)
at process.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:523:14)
at process.emit (node:events:519: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.4)
5条答案
按热度按时间4smxwvx51#
tsconfig.json:
kqlmhetl2#
因此,@proterm/core是具有重新导出和重新导出的重新导出的大文件的别名。此外,
selectStore
被声明为奇怪的形式:isr3a4wc3#
看起来这是一个问题,因为
作为syncSettings没有多个声明。在保存的时候,我不能移动其他函数,除非参考
selectStore
或者其他类似的东西。例如,这个也不起作用:目前的问题是来自 'react-use' 的
useLatest
,最小不起作用的示例:
1cklez4t4#
我也遇到了这个问题。当我尝试在vscode中移动到新文件时,扩展主机输出中会出现以下错误。
h7appiyu5#
@navya9singh 有关这个的更新吗?