Skip to content
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

Variable Pane doesn't know how to format formulas #4119

Closed
strengejacke opened this issue Jul 22, 2024 · 2 comments
Closed

Variable Pane doesn't know how to format formulas #4119

strengejacke opened this issue Jul 22, 2024 · 2 comments
Assignees
Labels
area: variables Issues related to Variables category. enhancement New feature or request lang: r support

Comments

@strengejacke
Copy link

Positron Version:

Positron Version: 2024.07.0 (system setup) build 2024.07.0-85
Code - OSS Version: 1.91.0
Commit: 9dfa34e
Date: 2024-07-22T03:21:08.974Z
Electron: 29.4.0
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22631

Steps to reproduce the issue:

Run following code, step-by-step:

ff <- "mo(gear)"
ff <- stats::as.formula(paste0("~", ff))
ff

First, the value of ff appears in the Variables view. After converting to formula, the value changes to ??.

variableview.mp4

What did you expect to happen?

The value of ff changes to ~mo(gear).

Were there any error messages in the Output panel or Developer Tools console?

No.

@strengejacke strengejacke added the bug Something isn't working label Jul 22, 2024
@juliasilge juliasilge changed the title Variable value changes to "unknown" after converting string into formula Variable Pane doesn't know how to format formulas Jul 22, 2024
@juliasilge juliasilge added enhancement New feature or request area: variables Issues related to Variables category. support lang: r and removed bug Something isn't working labels Jul 22, 2024
@juliasilge juliasilge added this to the Release Candidate milestone Jul 22, 2024
@juliasilge
Copy link
Contributor

Notes for when we look at this:

From my perspective the main problem is that formulas and other objects like quosures have length > 1 but base::format() results of length 1:

x <- formula(y ~ a + b + c)
length(x)
#> [1] 3
length(base::format(x))
#> [1] 1

Created on 2024-08-23 with reprex v2.1.1

@dfalbel dfalbel self-assigned this Nov 15, 2024
lionel- added a commit that referenced this issue Nov 27, 2024
## Positron Notes

### Release Notes

#### New Features

- The variable pane now supports labels from the {haven} package
(#5327.

- The variable pane has improved support for formulas
(#4119).

#### Bug Fixes

- Assignments in function calls (e.g. `list(x <- 1)`) are now detected
by the missing symbol linter to avoid annoying false positive
diagnostics (#3048). The downside is that this causes
false negatives when the assignment happens in a call with local scope,
e.g. in `local()` or `test_that()`. In these cases the nested
assignments will incorrectly overlast the end of the call. We prefer to
be overly permissive than overly cautious in these matters.

- The following environment variables are now set in the same way that R
does:

  - `R_SHARE_DIR`
  - `R_INCLUDE_DIR`
  - `R_DOC_DIR`

  This solves a number of problems in situations that depend on these
variables being defined
(#3637).
lionel- added a commit that referenced this issue Nov 27, 2024
### Release Notes

#### New Features

- The variable pane now supports labels from the {haven} package
(#5327.

- The variable pane has improved support for formulas
(#4119).

#### Bug Fixes

- Assignments in function calls (e.g. `list(x <- 1)`) are now detected
by the missing symbol linter to avoid annoying false positive
diagnostics (#3048). The downside is that this causes
false negatives when the assignment happens in a call with local scope,
e.g. in `local()` or `test_that()`. In these cases the nested
assignments will incorrectly overlast the end of the call. We prefer to
be overly permissive than overly cautious in these matters.

- The following environment variables are now set in the same way that R
does:

  - `R_SHARE_DIR`
  - `R_INCLUDE_DIR`
  - `R_DOC_DIR`

This solves a number of problems in situations that depend on these
variables being defined
(#3637).

<!-- Thank you for submitting a pull request.
If this is your first pull request you can find information about
contributing here:
  * https://github.com/posit-dev/positron/blob/main/CONTRIBUTING.md

We recommend synchronizing your branch with the latest changes in the
main branch by either pulling or rebasing.
-->

<!--
  Describe briefly what problem this pull request resolves, or what
  new feature it introduces. Include screenshots of any new or altered
  UI. Link to any GitHub issues but avoid "magic" keywords that will 
  automatically close the issue. If there are any details about your 
approach that are unintuitive or you want to draw attention to, please
  describe them here.
-->
@testlabauto
Copy link
Contributor

Verified Fixed

Positron Version(s) : 2025.01.0-2
OS Version          : OSX

Test scenario(s)

Validated with filing instructions

Link(s) to TestRail test cases run or created:

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: variables Issues related to Variables category. enhancement New feature or request lang: r support
Projects
None yet
Development

No branches or pull requests

4 participants