Skip to content

Commit 3f0fc39

Browse files
committed
Recommend adding specs folder exclude list in .solargraph.yml
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.
1 parent 56ac102 commit 3f0fc39

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ end
4141

4242
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.
4343

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

@@ -50,7 +55,7 @@ Add `solargraph-rspec` to your `.solargraph.yml` and remove the `spec` directory
5055
include:
5156
- "**/*.rb"
5257
exclude:
53-
-- spec/**/*
58+
+- spec/**/*
5459
- test/**/*
5560
- vendor/**/*
5661
- ".bundle/**/*"

0 commit comments

Comments
 (0)