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

R: Completion inside [.data.table adds quotes to NSE name #3140

Closed
juliasilge opened this issue May 14, 2024 · 4 comments
Closed

R: Completion inside [.data.table adds quotes to NSE name #3140

juliasilge opened this issue May 14, 2024 · 4 comments
Assignees
Labels
area: completions Issues related to Completions area: kernels Issues related to Jupyter kernels and LSP servers bug Something isn't working lang: r

Comments

@juliasilge
Copy link
Contributor

From a private beta user: https://github.com/posit-dev/positron-beta/issues/188

Positron Version:

Positron Version: 2024.05.0 build 1151
Code - OSS Version: 1.89.0
Commit: a9ca01f
Date: 2024-05-04T22:27:22.155Z
Electron: 28.2.8
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Linux x64 5.15.0-105-generic

Steps to reproduce the issue:

library(data.table)
DT=data.table(abcdefg=1)
DT[, abc<tab>] # --> becomes DT[, "abcdefg"]

What did you expect to happen?

Auto-complete to DT[, abcdefg]. In this specific example, the query will work the same as data.frame, but not so in all but the simplest cases.

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

Not sure how to see Developer Tools console.

@juliasilge juliasilge added bug Something isn't working lang: r labels May 14, 2024
@juliasilge
Copy link
Contributor Author

Should we add this to #1603?

@bobjansen
Copy link

This is blocking for me. What can be done to fix this, where to look in the source?

@lionel-
Copy link
Contributor

lionel- commented Nov 4, 2024

@bobjansen This is implemented in Ark in the vicinity of completions_from_evaluated_object_names. I think it's just a matter of adding a branch for data.table in https://github.com/posit-dev/ark/blob/e17d38b67ede5e0dd3165476f9e0614ad2a5b0b4/crates/ark/src/lsp/completions/sources/utils.rs#L204.

You can test your build of Ark by setting the positron.r.kernel.path setting in Positron to point to ark/target/debug (that's where cargo build puts the executable).

There are unit tests at the bottom of this file. In another place we do this to test for data.table presence (we install it on CI but contributors might not have it):

    let has_data_table =
        r_task(|| harp::parse_eval_global("mtcars_dt <- data.table::data.table(mtcars)").is_ok());
    if !has_data_table {
        return;

@testlabauto
Copy link
Contributor

Verified Fixed

Positron Version(s) : Main on 2/20/25 at noon MST
OS Version          : OSX

Test scenario(s)

Tab at location in original filing autocompletes to:
DT[, abcdefg
(still need end bracket) but that seems like the gist of what was wanted)

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: completions Issues related to Completions area: kernels Issues related to Jupyter kernels and LSP servers bug Something isn't working lang: r
Projects
None yet
Development

No branches or pull requests

5 participants