[Bug] 项目树删除时在窗口线程逐个同步执行废纸篓命令或 os.RemoveAll,大目录或多选删除会卡住界面

Abierto
#2,083 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, macos
Área
desktop

Línea de trabajo

Start with desktop/internal/workbench/filetree_batch.go around removeTreeItems and treeRemovalDialog, then read filetree_menu.go around saveDocumentsThen and filetree_duplicate.go around moveToTrash. Trace how deletion runs for trash and permanent removal, then check the project’s existing tests for this flow. Done means large or multiple selections no longer block the window, the tree refreshes after completion, and failures are reported.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

review: high
Platform / 平台

macOS

Area / 模块

Project and workspace / 项目与工作区

Lithe version / Lithe 版本

main 0a234bd8d

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

OS and architecture / 操作系统与架构

macOS,Apple Silicon(代码审查发现;Windows 走同一份 Go 代码,只是外部命令不同)

Environment / 环境信息

Viva 桌面端,项目树删除功能,与 JDK、Maven、语言服务器无关。

Steps to reproduce / 复现步骤
  1. 打开一个项目,在项目树里选中一个较大的目录,或者多选几十个文件。
  2. 右键选择“删除”,在确认弹窗里点“移到废纸篓”(或“永久删除”)。
  3. 删除进行时尝试滚动项目树、切换标签页或输入。
Expected behavior / 预期行为

删除在后台执行,窗口保持响应;完成后刷新项目树,失败时给出提示。

Actual behavior / 实际行为

这是代码审查发现的问题,还没有实测卡顿时长。从代码看,删除在窗口线程上同步执行:

  • desktop/internal/workbench/filetree_batch.go:221 的 treeRemovalDialog 通过 c.After 在窗口线程调用 removeTreeItems。
  • removeTreeItems(filetree_batch.go:142)在 saveDocumentsThen 的回调里逐个调用 treeMoveToTrash 或 os.RemoveAll。选中的文件没有在编辑器里打开时,saveDocumentsThen(filetree_menu.go:453)会同步调用这个回调,所以整个循环都跑在窗口线程上。
  • moveToTrash(filetree_duplicate.go:109)每一项都启动一个外部进程,并等它退出(CombinedOutput),用的是 context.Background(),没有超时:
    • macOS:osascript,让 Finder 删除;
    • Windows:powershell,加载 Microsoft.VisualBasic 后移到回收站;
    • 其他平台:gio trash。
  • 选中 N 项就串行启动 N 个进程,每个都要几百毫秒,窗口在这段时间里不会重绘。永久删除时 os.RemoveAll 删大目录(例如 node_modules、target)同样会阻塞窗口线程。
  • 未验证的推测:macOS 第一次让 Finder 删除时可能会弹出“自动化”授权框,用户回答之前窗口线程一直在等。
Logs or diagnostic output / 日志或诊断输出
未采集。问题来自对 main 0a234bd8d 的代码审查,没有运行时日志或耗时测量。
Screenshots or recordings / 截图或录屏

无。

Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复报告。
  • I removed secrets and personal data from the report. / 我已从报告中移除敏感信息和个人数据。
Lenguaje dominante
TypeScript
Estrellas
1.8k
Forks
151
Merge medio
3 h 48 min
PR fusionados (30 d)
571

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de 1lck/Lithe-IDEA

Todos los issues de 1lck/Lithe-IDEA

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.