feat: Discover VS Code, Quarto and renv projects#130
Conversation
|
I was looking around to see what else I might need to update. It doesn't seem like here really advertises the criteria it uses for finding the project directory. And empirically it seems like a lot of people think that only an |
|
Thanks. I wonder if rprojroot should really be a standalone these days. You gave feedback to the documentation of this package some time ago, I never took action. It might be time to evaluate the use of |
|
I opened a new issue for the documentation ideas (#132), which is related, but I don't think we need to wait on that. I've manually tested that all 3 of the new criteria seem to be working. |
…ke-null test: Snapshot updates for rcc-smoke (null)
man/here.Rd
Outdated
| \item contains a file matching \verb{[.]Rproj$} with contents matching \verb{^Version: } in the first line | ||
| \item contains a directory \code{.vscode} | ||
| \item contains a file \verb{_quarto.yml} | ||
| \item contains a file \code{renv.lock} with contents matching "\code{Packages}:\s*\{` |
There was a problem hiding this comment.
Apparently more escaping is needed here. But it's not easily within the control of this PR 🤔
* checking DESCRIPTION meta-information ...Warning: /home/runner/work/here/here/check/here.Rcheck/00_pkg_src/here/man/here.Rd:54: unknown macro '\s'
man/here.Rd
Outdated
| \item contains a directory \code{.git} | ||
| \item contains a file \code{.git} with contents matching \verb{^gitdir: } | ||
| \item contains a directory \code{.svn} | ||
| \item contains a directory `.svn" |
There was a problem hiding this comment.
Also weird. Why is this not treated the same as .git? 🤔
|
I fixed the |
|
OK now I see where these docs are being produced, so presumably I can fix this. I'll give it a whirl. |
|
I went in a circles with regex fixups for a long time. The fundamental problem is having double quotes nested inside of double quotes. This comes up because the description of the Eventually I threw in the towel and designed the problem away in rprojroot. So now the docs here depend on dev rprojroot (well, a branch of dev rprojroot at this very moment). First I want to prove that this works. Then we can paper over the dev dependency thing to get here into a CRAN-releasable state. |
| "the directory hierarchy is walked upwards ", | ||
| "until a directory with at least one of the following conditions is found:", | ||
| gsub('"([^"]+)"', "`\\1`", format_root_criteria_items()), | ||
| format_root_criteria_items(), |
There was a problem hiding this comment.
I just found this easier to reason about by relocating the gsub() below. Now we do that while each criterion's description is still its own element. This also limits the damage an undesirable regex substitution can do, i.e. limits it to a single item versus communicating across the whole string (that was actually what caused the .svn weirdness before).
|
|
||
| format_root_criteria_items <- function(indent = 0) { | ||
| format <- format(.root_env$root$crit)[-1L] | ||
| format <- gsub("'([^']+)'", "`\\1`", format) |
There was a problem hiding this comment.
New location for this fixup and now looking for single-quoted strings instead of double-quoted.
| - contains a file matching `[.]Rproj$` with contents matching `^Version: ` in the first line | ||
| - contains a directory `.vscode` | ||
| - contains a file `_quarto.yml` | ||
| - contains a file `renv.lock` with contents matching `"Packages":\s*\{` |
There was a problem hiding this comment.
This one is the really difficult one!
| \item contains a file matching \verb{[.]Rproj$} with contents matching \verb{^Version: } in the first line | ||
| \item contains a directory \code{.vscode} | ||
| \item contains a file \verb{_quarto.yml} | ||
| \item contains a file \code{renv.lock} with contents matching \verb{"Packages":\\s*\\\{} |
|
@krlmlr I think this is ready to go and I'm sort of assuming this will be merged, in terms of stuff I'm doing over in usethis 😅, which I hope to release soon-ish. It doesn't really require dev rprojroot. But it helps to generate the docs in the presence of my rprojroot PR. |
|
I just freshened this PR @krlmlr, in light of the rprojroot release, so I think it's in good shape. |
|
Thanks! |
Closes #128
Closes #80