Skip to content

Packages not loaded prior to linting with coc-r-lsp #238

Closed

Description

@mllg

Not sure if this is an issue of this package, or a problem of coc-r-lsp, but I'm encountering some difficulties setting them up to work together.

Although linting basically works out of the box, it looks like the current buffer is getting processed by lintr without loading the package (or any dependencies, imports, ...) first. This results in many warnings generated by the object_usage_linter. If I run languageserver::diagnose_file("<file>", readLines("<file>") everything looks good OTOH.

Activity

  1. renkun-ken commented on Mar 31, 2020

    @renkun-ken
    Member

    This is quite similar with the cause of #235 since languageserver::diagnose_file actually pass the content being edited (often not saved to disk) to lintr::lint() so its original path is lost so that linters that rely on it no longer works as expected.

    object_usage_lintr is such a linter that relies on the file path to detect if it lives in a package (See https://github.com/jimhester/lintr/blob/master/R/object_usage_linter.R#L18) to determine its globals.

    #236 resolves #235 but the root cause is still there. We'll probably have to find another way to fix this.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions