RSpec support modules are not indexed
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start with lib/ruby_indexer/lib/ruby_indexer/configuration.rb at the default exclusion pattern referenced in the issue, then trace how rubyLsp.indexing includePatterns and excludePatterns are combined. Verify how VS Code settings are applied and make it possible to override the default spec/**/* exclusion so support files such as spec/my_helper_module.rb are indexed. Done means RSpec support module definitions can be indexed and navigated to from VS Code.
Written by the indexing model from the issue text.
Description
Description
Ruby LSP Information
VS Code Version
1.95.0
Ruby LSP Extension Version
0.8.12
Ruby LSP Server Version
0.21.3
Ruby LSP Addons
- Ruby LSP Rails
Ruby Version
3.1.6
Ruby Version Manager
rbenv
Installed Extensions
Click to expand
- gitlens (15.6.2)
- java (1.36.0)
- makefile-tools (0.11.13)
- remote-containers (0.388.0)
- ruby-extensions-pack (0.1.12)
- ruby-lsp (0.8.12)
- test-adapter-converter (0.2.1)
- vscode-docker (1.29.3)
- vscode-github-actions (0.27.0)
- vscode-gradle (3.16.4)
- vscode-java-debug (0.58.1)
- vscode-java-dependency (0.24.0)
- vscode-java-pack (0.29.0)
- vscode-maven (0.44.0)
- vscode-rdbg (0.2.2)
- vscode-ruby-test-adapter (0.9.2)
- vscode-test-explorer (2.22.1)
Ruby LSP Settings
Click to expand
Workspace
{}
User
{
"enableExperimentalFeatures": false,
"enabledFeatures": {
"codeActions": true,
"diagnostics": true,
"documentHighlights": true,
"documentLink": true,
"documentSymbols": true,
"foldingRanges": true,
"formatting": true,
"hover": true,
"inlayHint": true,
"onTypeFormatting": true,
"selectionRanges": true,
"semanticHighlighting": true,
"completion": true,
"codeLens": true,
"definition": true,
"workspaceSymbol": true,
"signatureHelp": true,
"typeHierarchy": true
},
"featuresConfiguration": {},
"addonSettings": {},
"rubyVersionManager": {
"identifier": "auto"
},
"customRubyCommand": "",
"formatter": "rubocop",
"linters": null,
"bundleGemfile": "",
"testTimeout": 30,
"branch": "",
"pullDiagnosticsOn": "both",
"useBundlerCompose": false,
"bypassTypechecker": false,
"rubyExecutablePath": "",
"indexing": {
"excludedPatterns": [
"node_modules/**/*",
"tmp/**/*",
"spec/**/*_spec.rb",
"db/**/*",
"factories/**/*",
"script/**/*"
]
},
"erbSupport": true,
"useLauncher": false
}
Reproduction steps
While it's possible to specify includePatterns and excludePatterns for rubyLsp.indexing, those values are concatenated to the default values for those settings. That makes it impossible to configure ruby-lsp to index RSpec support files.
For example, RSpec will add spec to $LOAD_PATH, so we can add some support file to spec/my_helper_module.rb, for example, and include that module in a context. Here's an example on how it works:
module LoggedInAsAdmin
extend RSpec::Core::SharedContext
before(:example) do
log_in_as :admin
end
end
describe "admin section" do
include LoggedInAsAdmin
# ...
end
In the example above, LoggedInAsAdmin is not going to be indexed, so we can't jump to its definition from VSCode.
Currently, it's not possible to override the exclusion pattern "spec/**/*" defined by default, from VSCode settings.
We should be allowed to override those exclusions in order to enable indexing of RSpec support files.
- Dominant language
- Ruby
- Stars
- 2k
- Forks
- 281
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/ruby-lsp
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug help-wanted pinned
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug pinned
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 68/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in Shopify/ruby-lsp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
palladius/rails8-app-on-gcp#145 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
rubocop/rubocop-rspec#2236 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
riscv/riscv-unified-db#2624 · 1 reaction ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100