Skip to content

Commit 19ad500

Browse files
authored
Document new indexing configuration approach (#2319)
1 parent 149a193 commit 19ad500

File tree

4 files changed

+44
-4
lines changed

4 files changed

+44
-4
lines changed

EDITORS.md

+16
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,19 @@ You can use the Ruby LSP with RubyMine (or IntelliJ IDEA Ultimate) through the f
205205
Note that there might be overlapping functionality when using it with RubyMine, given that the IDE provides similar features as the ones coming from the Ruby LSP.
206206

207207
[Ruby LSP plugin](https://plugins.jetbrains.com/plugin/24413-ruby-lsp)
208+
209+
# Indexing Configuration
210+
211+
To configure indexing, pass a JSON hash as part of the initialization options for your editor, for example:
212+
213+
```json
214+
{
215+
"indexing": {
216+
"excludedPatterns": ["**/test/**.rb"],
217+
"includedPatterns": ["**/bin/**"],
218+
"excludedGems": ["rubocop", "rubocop-performance"],
219+
"includedPatterns": ["rake"],
220+
"excludedMagicComments": ["compiled:true"]
221+
}
222+
}
223+
```

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ default gems, except for
7878
- Gems that only appear under the `:development` group
7979
- All Ruby files under `test/**/*.rb`
8080

81-
By creating a `.index.yml` file, these configurations can be overridden and tuned. Note that indexing dependent behavior, such as definition, hover, completion or workspace symbol will be impacted by the configurations placed here.
81+
This behaviour can be overridden and tuned. Learn how to configure it [for VS Code](vscode/README.md#Indexing-Configuration) or [for other editors](EDITORS.md#Indexing-Configuration).
82+
83+
Note that indexing-dependent behavior, such as definition, hover, completion or workspace symbol will be impacted by
84+
the configuration changes.
85+
86+
The older approach of using a `.index.yml` file has been deprecated and will be removed in a future release.
8287

8388
```yaml
8489
# Exclude files based on a given pattern. Often used to exclude test files or fixtures

lsp.code-workspace

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
"**/out": true,
1919
},
2020
"rubyLsp.bypassTypechecker": true,
21-
"rubyLsp.excludedPatterns": [
22-
"**/test/fixtures/**/*.rb"
23-
],
21+
"rubyLsp.indexing": {
22+
"excludedPatterns": [
23+
"**/test/fixtures/**/*.rb"
24+
],
25+
},
2426
"typescript.tsc.autoDetect": "off",
2527
}
2628
}

vscode/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,20 @@ When `rubyLsp.formatter` is set to `auto`, Ruby LSP tries to determine which for
440440
If the bundle has a **direct** dependency on a supported formatter, such as `rubocop` or `syntax_tree`, that will be used.
441441
Otherwise, formatting will be disabled and you will need add one to the bundle. Using globally installed formatters or
442442
linters is not supported, they must in your Gemfile or gemspec.
443+
444+
## Indexing Configuration
445+
446+
To configure indexing, pass a JSON hash as part of the Ruby LSP configuration, for example:
447+
448+
```jsonc
449+
// PROJECT/.vscode/settings.json
450+
{
451+
"rubyLsp.indexing": {
452+
"excludedPatterns": ["**/test/**.rb"],
453+
"includedPatterns": ["**/bin/**"],
454+
"excludedGems": ["rubocop", "rubocop-performance"],
455+
"includedPatterns": ["rake"],
456+
"excludedMagicComments": ["compiled:true"],
457+
},
458+
}
459+
```

0 commit comments

Comments
 (0)