redhat-developer / redhat-developer/vscode-java

// @formatter:off should impact save actions too

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

还没有人认领这个 Issue。

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

描述

This is probably a new feature request rather than a bug.

Currently, // @formatter:off and // @formatter:on are great for having VSCode not format part of your file. This behavior could also extend to save actions, not just formatting. For example, when using Args4J, you annotate fields with @Option and those fields are set for you based on command line arguments (through some kind of reflection black magic). If one of those fields is final, then Args4J throws an exception. Example of a field with the annotation:

@Option(name = "--write-tps", handler = LongOptionHandler.class, usage = "The target write tps when updating the table")
private Long writeTps = 1L;

When saving, VSCode will add final:

@Option(name = "--write-tps", handler = LongOptionHandler.class, usage = "The target write tps when updating the table")
private final Long writeTps = 1L;

but that is not desirable in this case.

Ideally we could use comments to turn off adding final, like this:

// @formatter:off
@Option(name = "--read-capacity", handler = LongOptionHandler.class, usage = "The target read capacity to utilize when scanning the table")
private Long readCapacity = 1L;

@Option(name = "--write-tps", handler = LongOptionHandler.class, usage = "The target write tps when updating the table")
private Long writeTps = 1L;

@Option(name = "--no-dry-run", handler = BooleanOptionHandler.class, usage = "If set to true, the backfill will be done to records needing it")
private Boolean noDryRun = false;
// @formatter:on

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 VSCode Java 的保存操作路径开始,追踪当前在格式化时如何处理 // @formatter:off/on。完成的标准是保存操作保持带标记区域不变,包括此处显示的 Args4J 字段,同时标记之外的行为保持不变。

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

评估

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

把新 issue 发到你的邮箱

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