Solargraph

A Ruby Language Server

Configuration

Solargraph checks for configuration settings in a .solargraph.yml file in the workspace’s root directory. Run solargraph config to generate a default configuration file.

Defaults

The default configuration looks something like this:

include:
- "**/*.rb"
exclude:
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
require: []
domains: []
reporters:
- rubocop
- require_not_found
max_files: 5000

include

A list of directory globs to include in Solargraph’s code maps. The default configuration includes all .rb files in the folder.

exclude

A list of directory globs to exclude from Solargraph’s code maps. The default configuration excludes the spec, test, and vendor folders.

require

Note: Consider adding requires with a YARD @!parse directive instead of using this configuration setting.

Use require to add require paths that are not explicitly defined in code.

Example:

require:
- sinatra/base

Solargraph will act as if a file in the project contained the line require 'sinatra/base'.

domains

Solargraph will use the designated classes and modules as contexts in which the project’s scripts will run. Example: if one of the domains is Class<Sinatra::Base>, the Sinatra DSL will be included in suggestions. (Whether you need to specify the domain inside Class<> depends on how the library is implemented.)

reporters

Solargraph provides diagnostics reporters to send diagnostics to the client. The reporters section selects
which reporters the language server should use:

reporters:
- rubocop
- require_not_found

rubocop enables RuboCop linting. Its rules can be configured in a .rubocop.yml file.

require_not_found highlights require calls where Solargraph could not resolve a required path. Note that this error does not necessarily mean that the path is incorrect; only that Solargraph was unable to recognize it.

typecheck will report problems with type tags. See Type Checking for more information.

You can use all! to tell the language server to use all available reporters.

Run solargraph reporters for a complete list of available reporters and their descriptions.

max_files

The maximum number of files to be mapped in the workspace. The default is 5000 files. Setting it to 0 disables the size limitation.