redhat-developer / redhat-developer/vscode-java
// @formatter:off should impact save actions too
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the VSCode Java save-action path and trace how // @formatter:off/on is currently handled for formatting. Done means save actions leave the annotated region unchanged, including the Args4J fields shown here, while behavior outside the markers remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100