Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"dense" and "readable" generators add a space after field parts that end in a number #185

Closed
sircfenner opened this issue Apr 7, 2024 · 1 comment · Fixed by #193
Closed

Comments

@sircfenner
Copy link

Current behavior, when running darklua process using either dense or readable generator and no rules specified:

x0.y()
-- becomes:
x0 .y()

Expected behavior is that the redundant space is not added.

Looks like the problematic generators are calling write_field, which calls write_prefix, which eventually calls should_break_with_space. This returns true where the identifier in the relevant part of the field expression ends in a number.

Tested on darklua version 0.13.0. The issue does not occur with the "retain_lines" generator.

@jeparlefrancais
Copy link
Contributor

Oh! This is a side effect of checking for instances where darklua writes a number followed by the concat operator, which needs to insert a space (like 1 ..var, instead of 1..var where it would read 1. as a number)

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 a pull request may close this issue.

2 participants