redhat-developer / redhat-developer/vscode-java

Formatting a Java file sometimes eats parts of the code

未关闭
#2,173 13 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

formatter
主要语言
TypeScript
星标
2.3k
派生
546
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

This is similar to a bug that existed in Eclipse maybe 5 or 10 years ago.

Every now and then when you press format, part of the code is deleted. This is really super bad for any IDE, especially when you have auto format on save turned on. "Done with your changes? Sure, let me just save and commit. Why did you commit broken code, it doesn't even compile? %#€""

It seems like the formatter and also code highlighting gets out of sync with reality when this happens, e.g. in this example you can see that return is incorrectly colored.

https://user-images.githubusercontent.com/260340/138037841-aabf6088-d086-41f0-9908-98e3ec7eb555.mov

Environment
  • Operating System: mac os Big Sur
  • JDK version: 17
  • Visual Studio Code version: 1.61.1
  • Java extension version: 0.82.0
Steps To Reproduce
  1. Use VS Code until it happens... there is no reliable way as far as I know

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从提供的录制内容以及 issue 中描述的格式化程序和代码高亮行为开始,使用列出的 macOS、JDK 17、VS Code 1.61.1 和 Java extension 0.82.0 环境。重现间歇性失败,或缩小触发条件的范围,然后验证格式化不再删除代码,并且高亮显示仍保持同步。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, typescript, vscode
领域
developer-experience, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。