-
Notifications
You must be signed in to change notification settings - Fork 69
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
Allow expanding all short function definitions #861
Changes from all commits
ef6c5ed
ad5398c
9b4803e
0c7f552
dc9e63f
5f69f96
107d4f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ Base.@kwdef struct Options | |
pipe_to_function_call::Bool = false | ||
short_to_long_function_def::Bool = false | ||
long_to_short_function_def::Bool = false | ||
force_long_function_def::Bool = false | ||
always_use_return::Bool = false | ||
whitespace_in_kwargs::Bool = true | ||
annotate_untyped_fields_with_any::Bool = true | ||
|
@@ -35,6 +36,22 @@ Base.@kwdef struct Options | |
yas_style_nesting::Bool = false | ||
short_circuit_to_if::Bool = false | ||
disallow_single_arg_nesting::Bool = false | ||
function Options(args...) | ||
opts = new(args...) | ||
if (opts.force_long_function_def === true) && | ||
(opts.short_to_long_function_def === false) | ||
msg = """ | ||
The combination `force_long_function_def = true` and `short_to_long_function_def = false` is invalid. | ||
""" | ||
throw(ArgumentError(msg)) | ||
end | ||
return opts | ||
end | ||
Comment on lines
+39
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this function is causing failures on Julia < v1.6 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ERROR: LoadError: LoadError: syntax: ... is not supported inside "new" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jw3126 update this when you get the chance and it should be g2g |
||
end | ||
|
||
function Base.show(io::IO, opt::Options) | ||
print(io, "Options") | ||
print(io, NamedTuple(key => getproperty(opt, key) for key in fieldnames(Options))) | ||
end | ||
|
||
function needs_alignment(opts::Options) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be 1.0.60 since it's not a breaking change of any kind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it. Although personally, I would interpret this PR as a feature that should increase the minor version instead of a bugfix that should increase the patch version.