redhat-developer / redhat-developer/vscode-java

Formatter File not respected when applying snippets

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

还没有人认领这个 Issue。

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

描述

I have a format xml specified in Java > Format > Settings: Url. When I run the command "Open Java Formatter Settings" my file is opened. No settings in the file are respected, however. Consider just this setting:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
    <profile kind="CodeFormatterProfile" name="BradsProfile" version="12">
        <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line"/>
    </profile>
</profiles>

In the editor after typing 'if' followed by 2 tabs, I end up with this:

if (condition:var(boolean)) {
    
}

I don't see any errors in "Language Support for Java."

Environment
  • Operating System: Windows 10
  • JDK version: 11.0.14.101
  • Visual Studio Code version: 1.71.0
  • Java extension version: 1.10.0
Steps To Reproduce
  1. Configure formatter file with contents as above
  2. Type if statement as above

Can be as simple as a single .java file

Current Result
if (condition:var(boolean)) {
    
}
Expected Result
if (condition:var(boolean)) 
{
    
}

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先,使用提供的 formatter XML 和所示的 Java 扩展设置,在单个 .java 文件中复现该问题。跟踪展开 if-statement 代码片段时 formatter 文件的加载和应用过程。完成标准是遵循配置的 next_line 花括号位置,并且提供的复现不再产生当前布局。

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

评估

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

把新 issue 发到你的邮箱

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