REditorSupport / REditorSupport/languageserver
Accessing/suggesting completion and doc for functions 'called' via namespace and the namespace access operators (double/triple colon)
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 675
- Forks
- 118
- Avg merge
- 1d 37m
- Merged PRs (30d)
- 11
Description
Hi,
TL;DR
When packages are declared to be attached via library, languageserver suggests their functions as completions and gives access to their documentation. However, when a function is accessed via namespace + access operator (e.g. typing purrr::wal for purrr::walk) without a library declaration, it does not work.
Is there something I miss, or do you think you could implement such functionality?
Extended description
I mainly use R via Emacs (ess-r-mode, from the pkg Emacs Speaks Statistics, and r-ts-mode, from ESR pkg). ESS, in the same vein I think as RStudio, provides a completion system that allows to have e.g. purrr::walk suggested when typing purrr::wal, and gives access to its documentation. The drawback is that this completion system requires to have an associated R process running.
On the other hand, r-ts-mode leverages tree-sitter and, coupled with e.g. Eglot (Emacs-native LSP client), provides a pretty interesting IDE solution. However, the LSP features it gives access to is determined by languageserver, and since typing e.g. purrr::wal does not suggest purrr::walk , I guess the functionality is missing from languageserver itself.
While it is possible that there is something I am missing in my current Eglot + languageserver config, I am rather confident that the 'issue' comes from languageserver. Do you think implementing the previously described functionality would be feasible?
Finally, many thanks for your work with languageserver.
Edit: languageserver 0.3.18 and R 4.6.0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing completion and documentation lookup for purrr::wal and purrr:::wal in languageserver without a library declaration. Read the existing LSP completion and documentation behavior for attached packages, then trace how namespace access is represented. Done means namespaced functions can be suggested and their documentation accessed in the described cases, with tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100