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

format the split to multi-line string error when starts with a #{...} #15242

Open
zw963 opened this issue Dec 3, 2024 · 0 comments
Open

format the split to multi-line string error when starts with a #{...} #15242

zw963 opened this issue Dec 3, 2024 · 0 comments
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:formatter

Comments

@zw963
Copy link
Contributor

zw963 commented Dec 3, 2024

Because following string is too long, i want to split it into two line.

# version 1

require "option_parser"

long_long_variable = 100
foo = ""

OptionParser.parse do |parser|
  parser.on(
    "--build-args=ARGS",
    "Specifies arguments for the build command, (default: #{long_long_variable}, will override --src flag)"
  ) do |args|
    foo = args
  end
end

So, i change to this:

require "option_parser"

long_long_variable = 100
foo = ""

OptionParser.parse do |parser|
  parser.on(
    "--build-args=ARGS",
    "Specifies arguments for the build command, (default: \
#{long_long_variable}, will override --src flag)"
  ) do |args|
    foo = args
  end
end

Above valid crystal code always be revert to version 1 unexpected by formatter.

this issue only happen when wrapped line start with a #{..}

Thanks

@zw963 zw963 added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:formatter
Projects
None yet
Development

No branches or pull requests

2 participants