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

Function signature #959

Closed
sgorm123 opened this issue Jun 20, 2022 · 3 comments · Fixed by #968
Closed

Function signature #959

sgorm123 opened this issue Jun 20, 2022 · 3 comments · Fixed by #968

Comments

@sgorm123
Copy link

sgorm123 commented Jun 20, 2022

Could I recommend the styler create the function signature to align the = signs? Example below, it just feels a little more elegant to me. The same is true for any function call.
Just a thought and thanks for creating this package.
Stephen

derive_param_lasta <- function(dataset         = NULL,
                               order           = admiral::vars(STUDYID, USUBJID, ADT),
                               by_vars         = admiral::vars(STUDYID, USUBJID),
                               filter_source   = PARAMCD == "OVR" & ANL01FL == "Y",
                               source_pd       = NULL,
                               source_datasets = list(adrs = adrs),
                               subject_keys    = admiral::vars(STUDYID, USUBJID),
                               set_values_to   = NULL) {
@lorenzwalthert
Copy link
Collaborator

@sgorm123 thanks for the suggestion. For function calls, {styler} can already detect many alignment situations. See https://styler.r-lib.org/dev/articles/detect-alignment.html. I agree that it would be nice to detect alignment also for function headers.

@lorenzwalthert
Copy link
Collaborator

Also see #258.

@IndrajeetPatil
Copy link
Collaborator

Minimal reproducible example:

styler::style_text("foo <- function(x   = NULL,
                                    xy  = NULL,
                                    xyz = NULL) {}")
#> foo <- function(x = NULL,
#>                 xy = NULL,
#>                 xyz = NULL) {}

Created on 2022-06-20 by the reprex package (v2.0.1)

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

Successfully merging a pull request may close this issue.

3 participants