打开大文件后,VS Code 在重新启动时崩溃 [英] VS Code crashing on restart after opening large file

查看:168
本文介绍了打开大文件后,VS Code 在重新启动时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近使用 VS 代码通过使用命令行标志 --max-memory=12288mb 从命令行打开来打开一个大文件.我能够很好地编辑文件并完成我需要做的事情,然后正常关闭代码.

I recently used VS code to open a large file by opening from the command line using the command line flag --max-memory=12288mb. I was able to edit the file fine and finished what I needed to do and then closed code as normal.

默认情况下,我启用了 restoreWindowshotExit 设置,这样当我重新打开代码时,所有以前的文件都会启用.

By default I have the restoreWindows and hotExit settings enabled, so that when I re-open code all the previous files are enabled.

此后,每当我通过快捷方式或上下文菜单打开 VS Code 时,它​​都会尝试重新打开大文件并在启动后约 10 秒内崩溃.并显示警告:

After this whenever I open a VS Code via the shortcut or context menu, it attempts to re-open the large file and crashes within ~10 seconds of starting. And displays the warning:

窗户坏了

给您带来的不便,我们深表歉意!您可以重新打开窗口以从上次中断的地方继续

We are sorry for the inconvenience! You can reopen the window to continue where you left off

我尝试了几个步骤来尝试在 10 秒内关闭/阻止文件重新打开:

I tried a few steps to attempt to close/prevent the file reopening all during the functioning 10 seconds:

  1. 使用x"图标关闭标签
  2. 使用文件菜单中的关闭编辑器关闭文件夹关闭窗口选项
  3. 设置 "window.restoreWindows": "none""files.hotExit": "off" 以尝试防止文件自动被删除重新加载
  1. Close the tab using the 'x' icon
  2. Using the Close Editor, Close Folder and Close Window options in the file menu
  3. Setting "window.restoreWindows": "none" and "files.hotExit": "off" to try and prevent the file from automatically being reloaded

我也试过在禁用扩展的情况下运行 VS Code

I have also tried running VS Code with extensions disabled

推荐答案

解决方案是使用以下命令再次从命令行启动 VS Code

The solution was to start VS Code from the command line again with the following command

code --disable-extensions --max-memory=12288mb

然后关闭有问题的文件并在没有任何打开文件的情况下正确退出 VS Code.这样可以防止 VS Code 在重新启动时尝试重新打开大文件.

Then to close the offending file and correctly exit VS Code without any open files. This then prevent VS Code from attempting to re-open the large file when restarting.

我相信这是 VS Code 中的一个错误,因为它感觉好像在重新加载文件时应该显示相同的警告以正确的内存重新启动,就像第一次尝试打开文件时一样.我在 此处 提出了一个错误.

I believe that this is a bug in VS Code as it feels as though it should display the same warning to restart with the correct memory when re-loading files as it does when first attempting to open the file. I've raised a bug with MS here.

希望这对某人有所帮助!

Hopefully this helps someone!

这篇关于打开大文件后,VS Code 在重新启动时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆