MyNixOS website logo
Description

Automated Setup and Auto Run for R Language Server.

Allows to install the R 'languageserver' with all dependencies into a separate library and use that independent installation automatically when R is instantiated as a language server process. Useful for making language server seamless to use without running into package version conflicts.

languageserversetup

Setup and initialize R language server seamlessly and automatically with editors such as VS Code across platforms.

CRAN Dependencies License Coverage Check-CRAN Check-Solaris

Deploy-MS-Win Deploy-MacOS Deploy-CRAN Deploy-Dev

Features

  • Installs the languageserver package and all of its dependencies into a separate, independent library
  • Adds code to .Rprofile to make startup of the language server seamless when appropriate
  • Checks whether an R process is triggered as an instance of the languageserver and if so uses the independent library to prevent conflicts with other packages that the user uses
  • The languageserver installation does not affect the packages users currently have installed

Installation

You can install languageserversetup from CRAN. It has no dependencies, so no other packages are installed:

install.packages("languageserversetup")

You can also install the latest development version from the master branch on GitHub using the remotes package:

remotes::install_github("jozefhajnala/languageserversetup")

Usage

  1. Install the languageserver package and all it's dependencies into a separate independent library (Will ask for confirmation before taking action)
languageserversetup::languageserver_install()
  1. Add code to .Rprofile to automatically instantiate languageserver if the process is an instance of the languageserver, otherwise, the R session will run as usual with library paths unaffected
languageserversetup::languageserver_add_to_rprofile()
  1. Enjoy the cool functionality with VS Code or other editors

In action with VS Code

Install languageserversetup and use languageserver_install()

Installing the language server

Initialize the functionality with languageserver_add_to_rprofile()

Adding the language server to startup

All done, enjoy the awesomeness!

Platform support

Currently, the functionality is tested on 64bit versions of MS Windows 7, 10, Ubuntu 18.10 and MacOS El Capitan. Automated deployments and tests run via GitHub actions on macos-elcapitan-release, windows-x86_64-devel, ubuntu-gcc-release and fedora-clang-devel.

All PR and issues related to platform support are most welcome!

Removing the functionality

To remove the functionality, run (Will ask for confirmation before taking action):

languageserversetup::languageserver_remove_from_rprofile()

If the above does not succeed, remove the languageserersetup related code from your .Rprofile. Optionally, you can also delete the library where languageserver was installed itself.

Customizing the behavior

Location of the languageserver library

  • The default location for the library is path.expand(file.path("~", "languageserver-library")).
  • To customize the location of the library, set options(langserver_library = "/desired/path/to/library")before running languageserver_install().
  • To tweak the behavior manually you can always change the .Rprofile code chunk created by languageserver_add_to_rprofile() to your liking manually. Since the installation is stand-alone, if you want, you can also manually move the entire library to a new location by simply copying the library directory.

Used .Rprofile

By default, an .Rprofile file located in the user's home directory is used. If it does not exist, it is created. If it does exist, code is appended to the end of the file (after user confirmation).

Development or CRAN version of languageserver?

The languageserver_install() function has a fromGitHub argument. Set it to FALSE to install the CRAN version of the languageserver package. Otherwise, the latest development version is installed from the master branch of the languageserver GitHub repository.

Options

The default package behavior can be adjusted by the following options, ideally placed in the .Rprofile file before the call to library(languageserversetup)

  • for troubleshooting purposes, use options(langserver_quiet = FALSE) to enable diagnostic messages
  • use options(langserver_quiet_serverproc = TRUE) to disable diagnostic messages for the language server identified process
  • to define a custom library location for the languageserver package and its dependencies, use options(langserver_library = "desired/path/to/library")

How does it work, extra options and arguments

Please refer to the help files:

?languageserver_install
?languageserver_startup
?languageserver_add_to_rprofile
?languageserver_remove_from_rprofile

Acknowledgments

  • This package would have no point if there was no implementation of the language server protocol for R
  • Thanks to rhub for making cross-platform checking and testing of R packages as easy as it gets
  • Thanks to the Rocker project for providing useful Docker images for R work

License

AGPL-3

Metadata

Version

0.1.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows