TypeScript TS服务器致命错误:无法读取未定义对象的属性(读取'charCount')

3lxsmp7m  于 4个月前  发布在  TypeScript
关注(0)|答案(2)|浏览(38)

类型:Bug

❗️❗️❗️ 请填写下面的部分,以帮助我们诊断问题 ❗️❗️❗️

TypeScript 版本: 5.2.2
重现崩溃的步骤
TS 服务器日志

❗️ 服务器日志已禁用。为了帮助我们解决类似这样的崩溃问题,请通过设置启用日志记录:

"typescript.tsserver.log": "verbose"

启用此设置后,将来的崩溃报告将包括服务器日志。

TS 服务器错误堆栈

服务器: syntax

TypeError: Cannot read properties of undefined (reading 'charCount')
    at _LineNode.walk (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:185555:30)
    at _LineIndex.edit (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:185454:17)
    at _ScriptVersionCache._getSnapshot (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:185260:31)
    at _ScriptVersionCache.lineOffsetToPosition (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:185279:17)
    at TextStorage.lineOffsetToPosition (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:175492:22)
    at ScriptInfo.lineOffsetToPosition (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:175811:29)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:182253:41
    at mapDefinedIterator (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:2681:19)
    at mapDefinedIterator.next (<anonymous>)
    at _ProjectService.applyChangesToFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:181077:16)
    at _ProjectService.applyChangesInOpenFiles (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:181048:14)
    at updateOpen (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:182242:29)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:184838:69
    at IpcIOSession.executeWithRequestId (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:184830:14)
    at IpcIOSession.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:184838:29)
    at IpcIOSession.onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:184880:51)
    at process.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:186461:14)
    at process.emit (node:events:513:28)
    at emit (node:internal/child_process:937:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

VS Code 版本:Code 1.82.2 (Universal) (abd2f3db4bdb28f9e95536dfa84d8479f1eb312d, 2023-09-14T05:59:47.790Z)
操作系统版本:Darwin arm64 22.3.0
模式:
系统信息
| 项目 | 值 |
| ------------ | ------------ |
| CPUs | Apple M1 Pro (10 x 24) |
| GPU 状态 | 2d_canvas: enabledcanvas_oop_rasterization: enabled_ondirect_rendering_display_compositor: disabled_off_okgpu_compositing: enabledmultiple_raster_threads: enabled_onopengl: enabled_onrasterization: enabledraw_draw: disabled_off_okvideo_decode: enabledvideo_encode: enabledvulkan: disabled_offwebgl: enabledwebgl2: enabledwebgpu: enabled |
| 负载(平均) | 2, 3, 3 |
| 内存(系统) | 16.00GB (0.21GB free) |
| 进程参数 | --crash-reporter-id e0430de1-e494-45c1-92d0-171c460cfba1 |
| 屏幕阅读器 | no |
| VM | 0% |扩展(3)
| 扩展名 | 作者(省略) | 版本 |
| ------------ | ------------ | ------------ |
| vscode-eslint | dba | 2.4.2 |
| prettier-vscode | esb | 10.1.0 |
| LiveServer | rit | 5.7.9 |A/B实验

vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30792226
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
3biah626:30602489
89544117:30613380
a9j8j154:30646983
showlangstatbar:30737416
962ge761:30841074
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30805730
pythonnoceb:30805159
copilotsettingc:30839828
synctok:30821570
dsvsc013:30795093
dsvsc014:30804076
diffeditorv2:30821572
dsvsc015:30845448
b91juud3

b91juud31#

感谢您提出这个问题!看起来您可能正在使用旧版本的VS Code,最新稳定版本是1.82.3。请尝试升级到最新版本并检查此问题是否仍然存在。
快乐编码!

qfe3c7zg

qfe3c7zg2#

我们需要一种方法来重现这个

相关问题