Skip to content

Conversation

@lavisha4193
Copy link

Why?

[Compiler] format generated code by header and line break

What does this PR do?

[Compiler] format generated code by header and line break

Related issues

Is there any related issue? If this PR closes them you say say fix/closes:

@lavisha4193 lavisha4193 changed the title [Compiler] format generated code by header and line break #3233 feat: [Compiler] format generated code by header and line break #3233 Jan 29, 2026
…tructs

- Add wrap_line/wrap_lines methods to BaseGenerator for smart line breaking
- Override wrap_line in Go generator to preserve function signatures and struct tags
- Override wrap_line in Python generator to preserve assignments and conditionals
- Modify Java generator to use string concatenation for long error messages
- Fix ruff formatting issues (multi-line if statements, trailing whitespace)

This fixes syntax errors in generated IDL code across Java, Go, and Python.
PrimitiveKind.ANY: "None",
}

def wrap_line(
Copy link
Collaborator

@chaokunyang chaokunyang Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this func handle cpp macro registeration and Python indent right?

We don't have semantics ath this line level. Maybe it will be more safe If we add line breaker when generating code in each language.

PrimitiveKind.ANY: "any",
}

def wrap_line(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer break line in each language at semantic level when generating code. Otherwise it's every easy to add wrong line breaker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compiler] format generated code by header and line break

2 participants