Language Server Protocol

An implementation of the Language Server Protocol for R. The Language Server protocol is used by an editor client to integrate features like auto completion. See < https://microsoft.github.io/language-server-protocol> for details.


CRAN_Status_Badge Build Status

languageserver is an implement of the Microsoft's Language Server Protocol for the language of R.

It is released on CRAN and can be easily installed by

install.packages("languageserver")

The development version of languageserver could be installed by running the following in R

source("https://install-github.me/REditorSupport/languageserver")

Rmarkdown

The R package knitr is required to enable languageserver for Rmarkdown files. languageserver doesn't specify knitr as a dependency however, users may need to install it manually.

Language Clients

These editors are supported by installing the corresponding package.

let g:LanguageClient_serverCommands = {
    \ 'r': ['R', '--slave', '-e', 'languageserver::run()'],
    \ }
(lsp-register-client
    (make-lsp-client :new-connection
        (lsp-stdio-connection '("R" "--slave" "-e" "languageserver::run()"))
        :major-modes '(ess-r-mode inferior-ess-r-mode)
        :server-id 'lsp-R))

Services Implemented

languageserver is still under active development, the following services have been implemented:

  • textDocumentSync (diagnostics)
  • hoverProvider
  • completionProvider
  • signatureHelpProvider
  • definitionProvider
  • referencesProvider
  • documentHighlightProvider
  • documentSymbolProvider
  • workspaceSymbolProvider
  • codeActionProvider
  • codeLensProvider
  • documentFormattingProvider
  • documentRangeFormattingProvider
  • documentOnTypeFormattingProvider
  • renameProvider
  • documentLinkProvider
  • executeCommandProvider

FAQ

Linters

With lintr 1.0.3, the linters can be specified by creating the .lintr file at the project or home directory. Details can be found at lintr documentation.

News

languageserver 0.2.6

  • fix a bug in completion items
  • lower bound lintr to 1.0.3
  • fix a bug in desc_get_deps
  • better support vscode settings

languageserver 0.2.5

  • deprecate languageserver.default_linters

languageserver 0.2.4

  • require latest styler release
  • handle windows crlf
  • disable homedir config until lintr is released
  • concat multiple lines in signature
  • Allow package name to contain dots (e.g. data.table)
  • completing variables defined in document
  • support completions and function signatures from documents
  • improve worksync consistency
  • sync all R files of a package
  • load packages in Depends field

Contributors:

  • Randy Lai
  • Lorenz Walthert
  • Kun Ren

languageserver 0.2.3

various improvements

bug fixes:

  • ensure unicode documentation
  • use * as itemBullet for hover help
  • check if rootUri is NULL

Contributors:

  • Randy Lai
  • Kun Ren
  • Ista Zahn

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("languageserver")

0.2.7 by Randy Lai, 17 days ago


https://github.com/REditorSupport/languageserver


Browse source code at https://github.com/cran/languageserver


Authors: Randy Lai


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports callr, collections, desc, jsonlite, lintr, R6, repr, stringr, styler, tools, utils

Suggests processx, knitr, testthat


See at CRAN