-
Notifications
You must be signed in to change notification settings - Fork 92
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
update R startup heuristic #1289
Conversation
Only start an R runtime immediately if the workspace contains R files, or if it's empty but the user has installed RStudio. This is less likely to incorrectly start R in Python projects for users that happen to have RStudio installed. See #1282 (comment) for more detail.
This won't start R in a workspace that has Quarto or R Markdown files, which is a pretty common situation for R users (no |
Good point! Will fix that |
Rmd files would definitively indicate R. qmd files could of course be either. You can use |
Here's an updated list of globs from poking around R projects on GitHub:
I'm wondering if the |
For existing R projects I think |
I'm going to leave out the qmd heuristic for now, although it's in a725cef (which I've since reverted) if we want it This is ready for review |
Co-authored-by: Julia Silge <julia.silge@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
'**/renv.lock', | ||
'**/.Rbuildignore', | ||
'**/.Renviron', | ||
'**/*.Rproj' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For performance, I think almost all of these should only be searched for at the workspace root since that's the only location at which we expect to find them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added **
s in all cases to cater for users who open a monorepo at the repo root. My assumption re performance was that, in the worst case, we would still have to iterate through every file in the workspace to check the **/*.R
pattern, so it shouldn't be a significant performance drop to add more **
patterns on top of that. Similarly, in the best case, we would match one of the **
patterns early, and the rest wouldn't matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen a somewhat common pattern where such repositories will have separate sub-directories for different language bindings; e.g. you have a folder for R bindings, Python bindings, and so on. In this scenario, because we cannot really ascertain what the "right" default runtime is, I would argue it would be better to search at the workspace root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking was that in that case we would start both an R and Python runtime. But if e.g you had multiple sub-directories with R projects using different R versions, I suppose we wouldn't know which specific R version to start, so I agree that we shouldn't set "immediate" startup behavior unless we're very certain. I'll make a follow-up PR.
…startup behavior Merge pull request #212 from posit-dev/immediate-startup heuristically set immediate startup behavior -------------------- Commit message for posit-dev/positron-python@a2f48a5: add conda files to startup heuristic -------------------- Commit message for posit-dev/positron-python@b788426: Update src/client/positron/provider.ts Co-authored-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> -------------------- Commit message for posit-dev/positron-python@0a7f647: heuristically set immediate startup behavior Set startup behavior to immediate if the workspace contains files relevant to Python development. Addresses #1282. Note that this branch won't work as expected until #1289 is merged. Authored-by: Wasim Lorgat <mwlorgat@gmail.com> Signed-off-by: Wasim Lorgat <mwlorgat@gmail.com>
…ristic Merge pull request #214 from posit-dev/immediate-startup refine immediate startup heuristic -------------------- Commit message for posit-dev/positron-python@2a5a988: refine immediate startup heuristic Restrict config files to the workspace root. See this discussion for more: #1289 (comment). Also fixes the `.venv` and `.conda` cases which were incorrectly searching for files with those names instead of folders. Relates to #1282. Authored-by: Wasim Lorgat <mwlorgat@gmail.com> Signed-off-by: Wasim Lorgat <mwlorgat@gmail.com>
…startup behavior Merge pull request #212 from posit-dev/immediate-startup heuristically set immediate startup behavior -------------------- Commit message for posit-dev/positron-python@a2f48a5: add conda files to startup heuristic -------------------- Commit message for posit-dev/positron-python@b788426: Update src/client/positron/provider.ts Co-authored-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> -------------------- Commit message for posit-dev/positron-python@0a7f647: heuristically set immediate startup behavior Set startup behavior to immediate if the workspace contains files relevant to Python development. Addresses #1282. Note that this branch won't work as expected until #1289 is merged. Authored-by: Wasim Lorgat <mwlorgat@gmail.com> Signed-off-by: Wasim Lorgat <mwlorgat@gmail.com>
…ristic Merge pull request #214 from posit-dev/immediate-startup refine immediate startup heuristic -------------------- Commit message for posit-dev/positron-python@2a5a988: refine immediate startup heuristic Restrict config files to the workspace root. See this discussion for more: #1289 (comment). Also fixes the `.venv` and `.conda` cases which were incorrectly searching for files with those names instead of folders. Relates to #1282. Authored-by: Wasim Lorgat <mwlorgat@gmail.com> Signed-off-by: Wasim Lorgat <mwlorgat@gmail.com>
Only start an R runtime immediately if the workspace contains R files, or if it's empty but the user has installed RStudio. This is less likely to incorrectly start R in Python projects for users that happen to have RStudio installed.
See #1282 (comment) for more detail.