Skip to content

Commit

Permalink
Recommend adding specs folder exclude list in .solargraph.yml
Browse files Browse the repository at this point in the history
During the testing of the gem with the
[gitlabs](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.solargraph.yml.example?ref_type=heads)
codebase, it resulted that there was a significant slow-down of the
solargraph due to specs pre-parsing at language server boot time.

Turns out, Solargraph treats `exclude:` key in `.solargraph.yml` config
file as "exclude pre-indexing" of directory, which in our case is
exactly what we want, being that specs ought to be isolated from one
another and the only dependency should be actually source code & test
utils.
  • Loading branch information
lekemula committed Jun 23, 2024
1 parent 56ac102 commit 3f0fc39
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ end

If you add them to your Gemfile, you'll have to tell your IDE plugin to use bundler to load the right version of solargraph.

Add `solargraph-rspec` to your `.solargraph.yml` and remove the `spec` directory from the `exclude` list.
Add `solargraph-rspec` to your `.solargraph.yml` as a plugin.

> [!CAUTION]
> To avoid **performance issues**, please keep the `spec/**/*` directory in **exclude** list in the Solargraph configuration.
> That does not actually *exclude* the specs, but rather avoids pre-indexing the specs when Solargraph boots up, and only parses
> the specs on demand when opened in the editor, which is what we usually want.
(if you don't have a `.solargraph.yml` in your project root, you can run `solargraph config` to add one)

Expand All @@ -50,7 +55,7 @@ Add `solargraph-rspec` to your `.solargraph.yml` and remove the `spec` directory
include:
- "**/*.rb"
exclude:
-- spec/**/*
+- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
Expand Down

0 comments on commit 3f0fc39

Please sign in to comment.