Skip to contents

To change a setting for one editor, send it in that client's R language server configuration. For example, this LSP configuration asks for inline signatures and value previews in the completion list.

Details

{
  "r": {
    "lsp": {
      "completion_label_details": true
    }
  }
}

These tables describe the workspace server started by run(). For the diagnostics controls supported by run_embedded() and its host-supplied package context, see the embedded host guide.

Clients use different configuration files. In VS Code's settings.json, the corresponding key is "r.lsp.completion_label_details". To set the same value in R, put the following in an .Rprofile read by the server's R process, then restart the language server.

options(languageserver.completion_label_details = TRUE)

An explicit languageserver.* R option takes precedence over the corresponding workspace setting. The entries below give the key after r.lsp. or languageserver., its default as an R value, and its effect.

Completion, help, and the outline

member_completion

TRUE. Infer members such as obj$field and S4 slots such as obj@slot. Also supplies member arguments, signatures, hover help, and definitions where the source is known.

s3_dispatch

TRUE. Use inferred S3 methods for argument suggestions, signature help, and hover. Can be set independently of member completion.

roxygen_type_hints

TRUE. Use leading type markers in source roxygen comments to infer members and S3 dispatch. Changing this setting leaves ordinary inference from code available.

roxygen_advisory_type_hints

FALSE. When roxygen type hints are enabled, also use verified Markdown class links and recognized class descriptions to suggest members. S3 dispatch and annotation Rename require explicit markers. See the roxygen type hints guide.

snippet_support

TRUE. Insert supported completions as snippets in clients that accept them.

completion_label_details

FALSE. Show signatures and type or value previews alongside suggestions in clients that display label details. Selected-item details also work with the default.

max_completions

200. Maximum number of suggestions to return.

rich_documentation

TRUE. Render installed-package help as rich Markdown when rmarkdown and Pandoc are available. Otherwise the server uses text help.

inlay_hints_minimum_arguments

2L. Minimum number of supplied arguments for a call to show parameter-name hints.

inlay_hints_minimum_argument_length

2L. Minimum number of characters in a parameter name for a hint. An initial dot is excluded.

nline_to_break_succession

2L. Number of consecutive blank lines that separate section groups in the outline and folding ranges.

glue_highlighting

TRUE. Use semantic tokens to color embedded R in recognized glue templates.

glue_highlight_functions

list(). Customize highlighting by exact call spelling. Set its value to the position of an unnamed template argument (starting at 1), a named argument, or FALSE to disable highlighting for that spelling.

link_file_size_limit

16777216. Maximum size in bytes (16 MiB) of the target file when resolving a document link.

Diagnostics and formatting

diagnostics

TRUE. Publish diagnostics from the selected linter.

diagnostics_backend

"lintr". Select lintr or jarl for diagnostics.

formatting_backend

"styler". Select styler or air for formatting.

backend_options

list(). Per-backend overrides for the executable, timeout in seconds (10 by default), and named environment variables.

lint_cache

FALSE. Allow lintr to cache results for files on disk.

diagnostics_cache_ttl

5. Seconds the server can reuse matching diagnostics in memory. Set to 0 to disable reuse.

diagnostics_delay

0.75. Seconds to wait before linting after a parse.

parse_delay

0.15. Seconds to wait before parsing after a text change.

diagnostics_cache_max_mb

16. Memory budget in MiB for a workspace's diagnostics cache.

parse_cache_max_mb

64. Memory budget in MiB for a workspace's cached document parses.

The server creates the two memory budgets when it opens a workspace. Set them in the server's R profile before opening the project. For installation commands and the formatting modes available with each backend, see Diagnose and format code. To supply an R function as the formatting style or a custom backend, see Custom styles and adapters.

Workspace indexing

index_mode

"auto". auto selects full in a package and lazy in a script folder. full discovers files across the workspace. lazy starts with open files and their static source dependencies. off disables workspace indexing and uses the legacy package-loading behavior.

project_helpers

list(). Map caller globs to workspace-relative helper filenames for Go to Definition. Requires an active workspace index.

index_include

"**/*.R". Workspace-relative glob or list of globs to include. Matching ignores case.

index_exclude

c("**/.git/**", "**/.svn/**", "**/.hg/**", "**/renv/**", "**/packrat/**", "**/.Rproj.user/**", "**/.cache/**", "**/node_modules/**", "**/build/**", "**/dist/**"). Workspace-relative glob or list of globs to exclude.

index_max_files

10000L. Maximum number of eligible R files discovered per workspace.

index_max_file_size_mb

2. Maximum size in MiB of each file included in the index.

index_batch_size

20L. Maximum number of shallow file summaries to build in one idle batch.

index_time_budget_ms

25. Approximate time budget in milliseconds for each batch.

index_persistent_cache

TRUE. Save validated summaries from a full index on disk. Lazy indexes live in memory.

Package metadata and rendered help use a separate disk cache rooted at tools::R_user_dir("languageserver", "cache"). Set the R option languageserver.package_cache_dir to a directory or to FALSE to disable this cache. The environment variable R_LANGSVR_PACKAGE_CACHE_DIR can set the directory when the R option is absent. If metadata workers time out on a slow machine, set R_LANGSVR_TIMEOUT_SCALE to a multiplier such as 3 to give them more time.

Logging and client capabilities

debug

FALSE. Log details about startup and server activity.

trace

FALSE. Include protocol trace output. A client can also change tracing during a session.

log_file

NULL. Write logs to standard error by default. Supply a path to append to a file.

server_capabilities

list(). Override individual entries in the capabilities advertised to the client. See Client capabilities.