redhat-developer / redhat-developer/vscode-java

Java Formatter settings are not used

未关闭
#3,020 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

If I open the flow-server project from https://github.com/vaadin/flow/tree/main/flow-server

and have Eclipse formatter settings set to use https://raw.githubusercontent.com/vaadin/flow/main/eclipse/VaadinJavaConventions.xml which defines <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
image

then when I open e.g. the HandlerHelperTest.java file, VS Code shows "Spaces: 8" in the bottom bar and formatting the file changes it to use indentation of 8 spaces instead of 4

The settings file should be fine because when I go back to command line and run mvn formatter:format in the project, the indentation is changed back to 4 spaces.

Environment
  • Operating System: macOs Ventura
  • JDK version: 17
  • Visual Studio Code version: 1.76.2
  • Java extension version: 1.16.0
Steps To Reproduce
  1. See above
Current Result

File is not formatted according to given settings

Expected Result

File is formatted according to given settings

贡献指南

打开贡献指南

从这里开始

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

调研方向

在 VS Code 中配置 VaadinJavaConventions.xml 后打开 flow-server 来复现问题,然后将 HandlerHelperTest.java 的格式化结果与 mvn formatter:format 的结果进行比较。追踪 Java 扩展如何读取和应用格式化程序设置。当 VS Code 始终使用与 Maven 格式化程序一致的已配置四空格缩进时,即视为完成。

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

评估

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

把新 issue 发到你的邮箱

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