Skip to content

Native Pipe & Diagnostics (Check arguments to R function calls) #10124

Closed

Description

@kalaschnik

It would be great if R Studio could respect the native pipe in the diagnostic: Check arguments to R function calls (Disabling that tick box is not an option)

The behavior right now (native pipe)
image

Expected behavior (already working using magrittr’s pipe)
image

Activity

  1. ronblum commented on Nov 23, 2021

    @ronblum
    Contributor

    @kalaschnik Thank you for raising this! Can you please provide the environment you're working with? I can't reproduce this problem, at least in recent versions of RStudio Desktop such as 2021.09.01+372 on MacOS 12.1 with R 4.1.1.

    System details

    RStudio Edition : <!-- Desktop or Server -->
    RStudio Version : 
    OS Version      : 
    R Version       : 
    
  2. added
    info needed
    on Nov 23, 2021
  3. kalaschnik commented on Nov 24, 2021

    @kalaschnik
    Author

    I just updated R and RStudio to the latest version. Issue is still persistent.

    R: 4.1.2
    RStudio: 2021.09.01 Build 372
    OS: macOS 10.15.7 (Catalina)
    
  4. kalaschnik commented on May 5, 2022

    @kalaschnik
    Author

    I just updated R and RStudio to the latest version. Issue is still persistent.

    R: 4.1.3
    RStudio: 2022.02.2 Build 485
    OS: macOS 10.15.7 (Catalina)
    
  5. removed
    info needed
    on May 5, 2022
  6. jgutman commented on May 5, 2022

    @jgutman
    Contributor

    Thanks for reporting this. I've reproduced the issue in 2022.06.0+352
    In the meantime, as a workaround, instead of leaving the function call blank, you can use the underscore placeholder. See below

    Screen Shot 2022-05-05 at 3 24 07 PM

    In 2022.02.02 build 485, line 2 does not raise a diagnostic warning, but line 3 still does. Ideally, none of these should raise an issue, as they are all valid code

  7. kevinushey commented on May 5, 2022

    @kevinushey
    Collaborator

    We might need to update this definition:

    inline bool isPipeOperator(const RToken& rToken)
    {
    static const boost::wregex rePipe(L"^%[^>]*>+[^>]*%$");
    return regex_utils::match(rToken.begin(), rToken.end(), rePipe);
    }

    (note that the old definition tried to capture most variations of the magrittr pipe operator)

  8. kalaschnik commented on May 6, 2022

    @kalaschnik
    Author

    @jgutman; @kevinushey thanks for checking this.
    Is the underscore the already implemented feature for named argument coming in R 4.2?

  9. jgutman commented on May 6, 2022

    @jgutman
    Contributor

    @jgutman; @kevinushey thanks for checking this. Is the underscore the already implemented feature for named argument coming in R 4.2?

    Yes, if an underscore is used as a placeholder with the |> pipe, no diagnostic warning is raised, whether used with a named or unnamed argument. This was added in the latest patch release, see release notes here . We unfortunately neglected to fix the diagnostic issue when no placeholder is used, but thanks for alerting us to this issue, and we plan to add support for this very shortly.

  10. romainfrancois commented on May 13, 2022

    @romainfrancois
    Contributor

    Verified on main (build not available yet):

    image

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

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions