Skip to content

fix(lsp): complete column names in aes() when data is piped into ggplot()#592

Merged
jalvesaq merged 1 commit into
mainfrom
fix/pipe-completion-ggplot2
Jun 10, 2026
Merged

fix(lsp): complete column names in aes() when data is piped into ggplot()#592
jalvesaq merged 1 commit into
mainfrom
fix/pipe-completion-ggplot2

Conversation

@PMassicotte

Copy link
Copy Markdown
Collaborator

Piping a dataframe into gglot() was not completing columns in aes().

Now:

image

…rror

fix(lsp/init.lua): ensure df_name fallback to firstobj if firstobj2 is nil
@PMassicotte PMassicotte marked this pull request as ready for review June 10, 2026 11:53
@jalvesaq

Copy link
Copy Markdown
Member

After swichting to the fix/pipe-completion-ggplot2 branch, I get completion of column names in

library(ggplot2)

dtfrm <- data.frame(var1 = rnorm(100), var2 = rnorm(100))

dtfrm |>
    ggplot(aes(x = v[cursor here]))

It doesn't work with

library(ggplot2)

mtcars |>
    ggplot(aes(x = car[cursor here]))

I think this is a minor issue since few people use data frames from packages (unless they are teaching R).

@PMassicotte

PMassicotte commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

After swichting to the fix/pipe-completion-ggplot2 branch, I get completion of column names in

library(ggplot2)

dtfrm <- data.frame(var1 = rnorm(100), var2 = rnorm(100))

dtfrm |>
    ggplot(aes(x = v[cursor here]))

It doesn't work with

library(ggplot2)

mtcars |>
    ggplot(aes(x = car[cursor here]))

I think this is a minor issue since few people use data frames from packages (unless they are teaching R).

I am not sure I understand; the mtcars is not working on the new branch?

On the main this is not working for me

image image

@jalvesaq

Copy link
Copy Markdown
Member

It's working now:

image

I don't know why it didn't work before. Maybe I did something wrong.

@jalvesaq

Copy link
Copy Markdown
Member

Thank you for fixing this bug!

@jalvesaq jalvesaq merged commit 2d42670 into main Jun 10, 2026
13 checks passed
@jalvesaq jalvesaq deleted the fix/pipe-completion-ggplot2 branch June 10, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants