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 檔案重現該報告。檢查 plugin 的 save actions 行為和可用的 logs;完成的標準是儲存時檔案會重新格式化,且 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 摘要。