{"id":20396833,"url":"https://github.com/reditorsupport/languageserver","last_synced_at":"2025-05-14T05:10:42.432Z","repository":{"id":39606101,"uuid":"103085772","full_name":"REditorSupport/languageserver","owner":"REditorSupport","description":"An implementation of the Language Server Protocol for R","archived":false,"fork":false,"pushed_at":"2025-04-10T04:52:39.000Z","size":1570,"stargazers_count":612,"open_issues_count":123,"forks_count":99,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-14T13:58:27.684Z","etag":null,"topics":["language-server-protocol","r"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/REditorSupport.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-11T03:31:07.000Z","updated_at":"2025-04-13T21:20:16.000Z","dependencies_parsed_at":"2023-02-19T03:15:47.846Z","dependency_job_id":"6fae2200-2058-465f-82f8-63b33243d958","html_url":"https://github.com/REditorSupport/languageserver","commit_stats":{"total_commits":1373,"total_committers":32,"mean_commits":42.90625,"dds":0.5411507647487255,"last_synced_commit":"7f7605b55a6cbe05e0033b40f21e87408c06e102"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/REditorSupport%2Flanguageserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/REditorSupport%2Flanguageserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/REditorSupport%2Flanguageserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/REditorSupport%2Flanguageserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/REditorSupport","download_url":"https://codeload.github.com/REditorSupport/languageserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["language-server-protocol","r"],"created_at":"2024-11-15T04:09:49.528Z","updated_at":"2025-05-14T05:10:42.412Z","avatar_url":"https://github.com/REditorSupport.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# languageserver: An implementation of the Language Server Protocol for R\n\n[![R-CMD-check](https://github.com/REditorSupport/languageserver/actions/workflows/rcmdcheck.yml/badge.svg)](https://github.com/REditorSupport/languageserver/actions/workflows/rcmdcheck.yml)\n[![codecov](https://codecov.io/gh/REditorSupport/languageserver/branch/master/graph/badge.svg)](https://app.codecov.io/gh/REditorSupport/languageserver)\n[![CRAN\\_Status\\_Badge](http://www.r-pkg.org/badges/version/languageserver)](https://cran.r-project.org/package=languageserver)\n[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/grand-total/languageserver)](https://cran.r-project.org/package=languageserver)\n[![r-universe](https://reditorsupport.r-universe.dev/badges/languageserver)](https://reditorsupport.r-universe.dev/ui/#package:languageserver)\n\n`languageserver` is an implementation of the Microsoft's [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) for the language of R.\n\n- [Installation](#installation)\n- [Language Clients](#language-clients)\n- [Services Implemented](#services-implemented)\n- [Settings](#settings)\n- [FAQ](#faq)\n  - [Linters](#linters)\n  - [Customizing server capabilities](#customizing-server-capabilities)\n  - [Customizing formatting style](#customizing-formatting-style)\n\n## Installation\n\nA few dependencies are required beforehand:\n\n```bash\n# On Debian, Ubuntu, etc.\napt install --assume-yes --no-install-recommends build-essential libcurl4-openssl-dev libssl-dev libxml2-dev r-base\n\n# On Fedora, Centos, etc.\ndnf install --assumeyes --setopt=install_weak_deps=False @development-tools libcurl-devel libxml2-devel openssl-devel R\n\n# On Alpine\napk add --no-cache curl-dev g++ gcc libxml2-dev linux-headers make R R-dev\n```\n\n`languageserver` is released on CRAN and can be easily installed by\n\n```r\ninstall.packages(\"languageserver\")\n```\n\nTo try the latest features, install the daily development build from our [r-universe](https://reditorsupport.r-universe.dev) repository:\n\n```r\ninstall.packages(\"languageserver\", repos = c(\n    reditorsupport = \"https://reditorsupport.r-universe.dev\",\n    getOption(\"repos\")\n))\n```\n\nOr install the latest development version from our GitHub repository:\n\n```r\n# install.packages(\"remotes\")\nremotes::install_github(\"REditorSupport/languageserver\")\n```\n\n## Language Clients\n\nThe following editors are supported by installing the corresponding extensions:\n\n- VS Code: [vscode-R](https://github.com/REditorSupport/vscode-R)\n\n- Atom: [atom-ide-r](https://github.com/REditorSupport/atom-ide-r)\n\n- Sublime Text: [R-IDE](https://github.com/REditorSupport/sublime-ide-r)\n\n- Vim/NeoVim: [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim) with settings\n\n    ```vim\n    let g:LanguageClient_serverCommands = {\n        \\ 'r': ['R', '--no-echo', '-e', 'languageserver::run()'],\n        \\ }\n    ```\n\n  or, if you use [coc.nvim](https://github.com/neoclide/coc.nvim), you can do one of two things:\n  \n  - Install [coc-r-lsp](https://github.com/neoclide/coc-r-lsp) with:\n\n    ```vim\n    :CocInstall coc-r-lsp\n    ```\n\n  - or install the languageserver package in R\n\n    ```r\n    install.packages(\"languageserver\")\n    # or install the developement version\n    # remotes::install_github(\"REditorSupport/languageserver\")\n    ```\n\n    Then add the following to your Coc config:\n\n    ```json\n    \"languageserver\": {\n        \"R\": {\n            \"command\": \"/usr/bin/R\",\n            \"args\" : [ \"--no-echo\", \"-e\", \"languageserver::run()\"],\n            \"filetypes\" : [\"r\"]\n        }\n    }\n    ```\n\n- Emacs: [lsp-mode](https://github.com/emacs-lsp/lsp-mode)\n\n- JupyterLab: [jupyterlab-lsp](https://github.com/jupyter-lsp/jupyterlab-lsp)\n\n- [BBEdit](https://www.barebones.com/products/bbedit/): preconfigured in version 14.0 and later; see the [BBEdit LSP support page](https://www.barebones.com/support/bbedit/lsp-notes.html) for complete details.\n\n- [Nova](https://nova.app): [R-Nova](https://github.com/jonclayden/R-Nova)\n\n## Services Implemented\n\n`languageserver` is still under active development, the following services have been implemented:\n\n- [x] [textDocumentSync](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_synchronization)\n- [x] [publishDiagnostics](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_publishDiagnostics)\n- [x] [hoverProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover)\n- [x] [completionProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion)\n- [x] [completionItemResolve](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#completionItem_resolve)\n- [x] [signatureHelpProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp)\n- [x] [definitionProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition)\n- [x] [referencesProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references)\n- [x] [documentHighlightProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight)\n- [x] [documentSymbolProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol)\n- [x] [workspaceSymbolProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_symbol)\n- [x] [codeActionProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction)\n- [ ] [codeLensProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeLens)\n- [x] [documentFormattingProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting)\n- [x] [documentRangeFormattingProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rangeFormatting)\n- [x] [documentOnTypeFormattingProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_onTypeFormatting)\n- [x] [renameProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename)\n- [x] [prepareRenameProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_prepareRename)\n- [x] [documentLinkProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentLink)\n- [x] [documentLinkResolve](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#documentLink_resolve)\n- [x] [colorProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentColor)\n- [x] [colorPresentation](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_colorPresentation)\n- [x] [foldingRangeProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_foldingRange)\n- [x] [selectionRangeProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_selectionRange)\n- [x] [prepareCallHierarchy](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_prepareCallHierarchy)\n- [x] [callHierarchyIncomingCalls](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy_incomingCalls)\n- [x] [callHierarchyOutgoingCalls](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy_outgoingCalls)\n- [ ] [prepareTypeHierarchy](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_prepareTypeHierarchy)\n- [ ] [typeHierarchySupertypes](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#typeHierarchy_supertypes)\n- [ ] [typeHierarchySubtypes](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#typeHierarchy_subtypes)\n- [ ] [semanticTokens](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens)\n- [ ] [linkedEditingRange](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_linkedEditingRange)\n- [ ] [executeCommandProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand)\n- [ ] [inlineValueProvider](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_inlineValue)\n- [ ] [inlayHintProivder](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_inlayHint)\n\n## Settings\n\n`languageserver` exposes the following settings via LSP configuration.\n\nsettings | default | description\n----     | -----   | -----\n`r.lsp.debug`  | `false` | increase verbosity for debug purpose\n`r.lsp.log_file` | `null` | file to log debug messages, fallback to stderr if empty\n`r.lsp.diagnostics` | `true` | enable file diagnostics via [lintr](https://github.com/r-lib/lintr)\n`r.lsp.rich_documentation` | `true` | rich documentation with enhanced markdown features\n`r.lsp.snippet_support` | `true` | enable snippets in auto completion\n`r.lsp.max_completions` | 200 | maximum number of completion items\n`r.lsp.lint_cache` | `false` | toggle caching of lint results\n`r.lsp.server_capabilities` | `{}` | override server capabilities defined in [capabilities.R](https://github.com/REditorSupport/languageserver/blob/master/R/capabilities.R). See FAQ below.\n`r.lsp.link_file_size_limit` | 16384 | maximum file size (in bytes) that supports document links\n\nThese settings could also specified in `.Rprofile` file via `options(languageserver.\u003cSETTING_NAME\u003e =  \u003cVALUE\u003e)`. For example,\n\n```r\noptions(languageserver.snippet_support = FALSE)\n```\n\nwill turn off snippet support globally. LSP configuration settings are always overriden by `options()`.\n\n## FAQ\n\n### Linters\n\nWith [lintr](https://github.com/r-lib/lintr) v2.0.0, the linters can be specified by creating the `.lintr` file at the project or home directory. Details can be found at lintr [documentation](https://lintr.r-lib.org/articles/lintr.html).\n\n### Customizing server capabilities\n\nServer capabilities are defined in\n[capabilities.R](https://github.com/REditorSupport/languageserver/blob/master/R/capabilities.R).\nUsers could override the capabilities by specifying the LSP configuration setting\n`server_capabilities` or\n`options(languageserver.server_capabilities)` in `.Rprofile`. For example, to turn off `definitionProvider`, one could either use LSP configuration\n\n```json\n\"r\": {\n    \"lsp\": {\n        \"server_capabilities\": {\n            \"definitionProvider\": false\n        }\n    }\n}\n```\n\nor R options\n\n```r\noptions(\n    languageserver.server_capabilities = list(\n        definitionProvider = FALSE\n    )\n)\n```\n\n### Customizing formatting style\n\nThe language server uses [`styler`](https://github.com/r-lib/styler) to perform code formatting. It uses `styler::tidyverse_style(indent_by = options$tabSize)` as the default style where `options` is the [formatting\noptions](https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_formatting).\n\nThe formatting style can be customized by specifying `languageserver.formatting_style` option which\nis supposed to be a function that accepts an `options` argument mentioned above. You could consider to put the code in `.Rprofile`.\n\n[`styler::tidyverse_style`](\u003chttps://styler.r-lib.org/reference/tidyverse_style.html\u003e) provides numerous arguments to customize the formatting behavior. For example, to make it only work at indention scope:\n\n```r\noptions(languageserver.formatting_style = function(options) {\n    styler::tidyverse_style(scope = \"indention\", indent_by = options$tabSize)\n})\n```\n\nTo disable assignment operator fix (replacing `=` with `\u003c-`):\n\n```r\noptions(languageserver.formatting_style = function(options) {\n    style \u003c- styler::tidyverse_style(indent_by = options$tabSize)\n    style$token$force_assignment_op \u003c- NULL\n    style\n})\n```\n\nTo further customize the formatting style, please refer to [Customizing styler](https://styler.r-lib.org/articles/customizing_styler.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freditorsupport%2Flanguageserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freditorsupport%2Flanguageserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freditorsupport%2Flanguageserver/lists"}