A Ruby Language Server

Type Checking

Solargraph provides a type checker that can identify problems like missing tags and mismatched type inference.

Normal type checking verifies that all your methods have valid tags for parameters and return types.

Strict type checking will analyze code paths to make sure that the types inferred from static analysis match the existing tags. (Note: this feature is still under development. Expect false positives and bugs.)

The Command Line

From your workspace’s root directory, run the following:

$ solargraph typecheck

For problems in a particular file:

$ solargraph ./path/to/file.rb

The --strict argument will perform strict type checking.


Editors that support diagnostics can use the typecheck reporter. Add typecheck to your workspace’s reporters in .solargraph.yml:

- typecheck

Use typecheck:strict to enable the strict option (warning: expect bugs).

See Configuration for more information about .solargraph.yml.