Skip to content

Commit cbb0f01

Browse files
authored
Unify ruby-lsp-doctor with ruby-lsp command (#2310)
1 parent e7f54ad commit cbb0f01

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: bundle exec rake
4949

5050
- name: Run index troubleshooting tool
51-
run: bundle exec ruby-lsp-doctor
51+
run: bundle exec ruby-lsp --doctor
5252
lint_node:
5353
runs-on: ubuntu-latest
5454
steps:

exe/ruby-lsp

+25
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ parser = OptionParser.new do |opts|
3636
options[:experimental] = true
3737
end
3838

39+
opts.on("--doctor", "Run troubleshooting steps") do
40+
options[:doctor] = true
41+
end
42+
3943
opts.on("-h", "--help", "Print this help") do
4044
puts opts.help
4145
puts
@@ -107,4 +111,25 @@ if options[:time_index]
107111
return
108112
end
109113

114+
if options[:doctor]
115+
if File.exist?(".index.yml")
116+
begin
117+
config = YAML.parse_file(".index.yml").to_ruby
118+
rescue => e
119+
abort("Error parsing config: #{e.message}")
120+
end
121+
RubyIndexer.configuration.apply_config(config)
122+
end
123+
124+
index = RubyIndexer::Index.new
125+
126+
puts "Globbing for indexable files"
127+
128+
RubyIndexer.configuration.indexables.each do |indexable|
129+
puts "indexing: #{indexable.full_path}"
130+
index.index_single(indexable)
131+
end
132+
return
133+
end
134+
110135
RubyLsp::Server.new.start

exe/ruby-lsp-doctor

-23
This file was deleted.

ruby-lsp.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
1515

1616
s.files = Dir.glob("lib/**/*.rb") + ["README.md", "VERSION", "LICENSE.txt"]
1717
s.bindir = "exe"
18-
s.executables = ["ruby-lsp", "ruby-lsp-check", "ruby-lsp-doctor"]
18+
s.executables = ["ruby-lsp", "ruby-lsp-check"]
1919
s.require_paths = ["lib"]
2020

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

0 commit comments

Comments
 (0)