eclipse-xtext / eclipse-xtext/xtext

[enhancement] allow configuration of generated Java code indentation

Open
#2,255 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

One of the most attractive features of Xtend is that it generates Java source code, as it makes the transition from Java easier, it is useful to understand the semantics of Xtend, and it is key when working in projects with developers who are familiar with Java but not with Xtend. Unfortunately, the formatting of the generated Java code is less than ideal, and what's worse, it cannot be changed.

One problem particularly sticks out: the generated code uses a default indentation of two spaces, which can be quite hard to read (specially for people with poor eyesight). It would be desirable to be able to specify the indentation size in the Xtend preferences and maybe even the type: tabs or spaces.

Even better, generated Java code should adhere to whatever formatting settings are defined in the JDT. (But for now I would be happy if at least the indentation issue is resolved ;))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Xtend Java code-generation and preference entry points; no specific files or tests are named in the issue. The work is done when generated Java indentation can be configured for size and, if supported, tabs or spaces, with the behavior covered by the relevant existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.