Markdown Preview extremely laggy when resizing window with LaTeX formulas
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
https://github.com/user-attachments/assets/031a93df-73e9-40b7-ac3e-e45ddb8395ca
## Bug Description
When writing Markdown notes with mathematical formulas (LaTeX), performing any of the following operations causes severe lag:
1. **Dragging to resize the preview window**
2. **Frequently opening/closing Claude Code or Copilot sidebar via keyboard shortcuts**, causing the preview window to be repeatedly squeezed/stretched
## Steps to Reproduce
1. Open a Markdown file containing mathematical formulas (LaTeX)
2. Open Markdown Preview (or Markdown Preview Enhanced) pane
3. Drag to resize the window, or frequently toggle sidebar plugins (Claude Code / Copilot)
4. Observe: The preview window becomes extremely laggy, CPU usage spikes
## Expected Behavior
Window resizing should remain smooth without noticeable lag.
## Actual Behavior
- Code editor view (Raw Editor) performs normally
- Markdown Editor extension is acceptable, not very laggy
- **Markdown Preview / Markdown Preview Enhanced is extremely laggy**, especially with many formulas
- **Root cause (suspected)**: Non-code-view preview windows continuously re-render in real-time when the window is being squeezed, which has extremely high performance requirements
## Environment
- VS Code
- Extensions: Markdown Preview Enhanced, Claude Code, Copilot
- OS: Windows 11
- Screen recording: see attached video
---
## 问题描述
在使用 Markdown 编写公式笔记时,对预览窗口进行以下操作会导致严重卡顿:
1. **拖动调整预览窗口大小**
2. **通过快捷键频繁打开/关闭 Claude Code 或 Copilot 侧边栏**,导致预览窗口被反复挤压/拉伸
## 复现步骤
1. 打开包含数学公式(如 LaTeX)的 Markdown 文件
2. 打开 Markdown Preview(或 Markdown Preview Enhanced)预览窗口
3. 拖动调整窗口大小,或频繁切换侧边栏插件(Claude Code / Copilot)
4. 观察:预览窗口出现严重卡顿,CPU 占用飙升
## 预期行为
窗口调整时应保持流畅,不应出现明显卡顿。
## 实际行为
- 代码编辑视图(Raw Editor)表现正常
- Markdown Editor 扩展表现尚可,不太卡
- **Markdown Preview / Markdown Preview Enhanced 非常卡顿**,尤其是公式较多时
- **原因推测**:非代码视图的预览窗口在窗口被挤压时仍在实时重新渲染,对性能要求极高
## 环境信息
- VS Code
- 插件:Markdown Preview Enhanced、Claude Code、Copilot
- 系统:Windows 11
- 录屏:见附件视频
Contributor guide
Assessment
This issue has not been assessed yet.