Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Not formatting file on save in Intellij 2023.1

未关闭
#929 11 条评论 29 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

首先,在启用所列 save actions 的情况下,使用 IntelliJ 2023.1、google-java-format plugin 1.16.0.1 和一个需要格式化的 Java 文件重现该报告。检查插件的 save actions 行为和可用日志;完成的标准是保存时文件会重新格式化,并且 imports 会得到优化。

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

描述

IntelliJ

My Java files are not being formatted on save, only when I do a reformat manually. I can see that the google-java-format plugin is running when I save the file (it is quickly showing in the status bar), but the file is not reformatted. I cannot find any logs on this.

My setup

  • Intellij 2023.1 (Build #IU-231.8109.175, built on March 28, 2023)
  • google-java-format plugin 1.16.0.1
  • Activated "Reformat code" and "Optimize imports" under settings -> Tools -> actions on save
    *I have imported the intellij-java-google-style file under settings -> code style -> Scheme.
  • Runtime version: 17.0.6+10-b829.5 aarch64
  • VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

I have setup custom VM options as follows

-Xmx3072m
-Dsplash=true
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
主要语言
Java
星标
6.2k
派生
936
平均合并
6 分钟
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

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

google/google-java-format 的其他 Issue

查看 google/google-java-format 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

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