Skip to content

Commit 5806f09

Browse files
authored
Add ruby-lsp-doctor tool for troubleshooting indexing problems (#1117)
Add tool for troubleshooting indexing problems
1 parent 5b732eb commit 5806f09

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ jobs:
4242

4343
- name: Run tests
4444
run: bundle exec rake
45+
46+
- name: Run index troubleshooting tool
47+
run: ./exe/ruby-lsp-doctor

exe/ruby-lsp-doctor

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "bundler/setup"
5+
6+
require "ruby_lsp/internal"
7+
8+
index = RubyIndexer::Index.new
9+
10+
RubyIndexer.configuration.indexables.each do |indexable|
11+
puts "indexing: #{indexable.full_path}"
12+
content = File.read(indexable.full_path)
13+
result = Prism.parse(content)
14+
visitor = RubyIndexer::IndexVisitor.new(index, result, indexable.full_path)
15+
result.value.accept(visitor)
16+
end

ruby-lsp.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
1414

1515
s.files = Dir.glob("lib/**/*.rb") + ["README.md", "VERSION", "LICENSE.txt"]
1616
s.bindir = "exe"
17-
s.executables = ["ruby-lsp", "ruby-lsp-check"]
17+
s.executables = ["ruby-lsp", "ruby-lsp-check", "ruby-lsp-index-info"]
1818
s.require_paths = ["lib"]
1919

2020
s.add_dependency("language_server-protocol", "~> 3.17.0")

0 commit comments

Comments
 (0)