insertText()'s location= argument -- is '0' a valid column number?

Open
#299 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
documentation

Research direction

Start with the insertText() documentation in R/document-api.R and the related implementation reference in R/code.R. Determine whether location=0 is accepted by the RStudio API, then update the documentation to state the valid column range clearly so downstream users can decide how to handle SARIF output.

Written by the indexing model from the issue text.

Description

https://github.com/rstudio/rstudioapi/blob/3304988af6ba2b70ec1774aa6eb31a37a75d4c7e/R/document-api.R#L33

I couldn't tell from ?insertText whether 0 is valid or not. Of course I could test this with RStudio available, but I don't have it available at the moment, so it would be good to have this written out. The source code of rstudioapi::insertText() also eventually refers to a function inside an environment only available inside RStudio, so I couldn't check that either:

https://github.com/rstudio/rstudioapi/blob/3304988af6ba2b70ec1774aa6eb31a37a75d4c7e/R/code.R#L156

Context: We have a conflict in {lintr} of 0 being a valid column number for lint objects, apparently to support RStudio:

https://github.com/r-lib/lintr/pull/2418#discussion_r1555250719

But this conflicts with SARIF format (https://github.com/r-lib/lintr/issues/2550), which requires column>0. I'd like to know if the fix is to block 0 as a column number everywhere, or if we should just block it when producing SARIF output.

To answer this I tried to refer to the {rstudioapi} documentation, but to no avail.

Dominant language
R
Stars
175
Forks
37
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rstudio/rstudioapi

All issues in rstudio/rstudioapi

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.