REditorSupport / languageserver

An implementation of the Language Server Protocol for R
Other
564 stars 91 forks source link

Completion dataframe variable/columns #638

Closed PMassicotte closed 3 months ago

PMassicotte commented 8 months ago

First, thank you for the work on languageserver.

I am using neovim and I would like to know if it is possible to get column names completion when using the pipe operator.

For example, inside mutate(), is it possible to have access to the mtcars columns?

image

ktrutmann commented 3 months ago

Hey, just so you have at least some answer: Column name completion is generally not supported currently, because it would require the languageserver to hook into the active R session to grab the elements there. Currently the server is only analysing the script, and basically "only knows what's there". That means if you load some csv it has no way of knowing what the variable names will be. With the mtcars dataframe you used as an example it's theoretically possible, because it stemms from a package. But that would be very inconsistent behavior then. I remember this being mentioned in some other issue and I think it's not currently on the roadmap sadly.

PMassicotte commented 3 months ago

Thank you for the answer.

It is now supported in R.nvim

image

ktrutmann commented 3 months ago

Oh, cool. Thanks for the hint. I'm currently using SublimeText and am happy with it except for the languageserver that somehow doesn't want to work properly. Neovim seems more attractive by the day...