Skip to content

Commit

Permalink
Unify ruby-lsp-doctor with ruby-lsp command (#2310)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 authored Jul 15, 2024
1 parent e7f54ad commit cbb0f01
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: bundle exec rake

- name: Run index troubleshooting tool
run: bundle exec ruby-lsp-doctor
run: bundle exec ruby-lsp --doctor
lint_node:
runs-on: ubuntu-latest
steps:
Expand Down
25 changes: 25 additions & 0 deletions exe/ruby-lsp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ parser = OptionParser.new do |opts|
options[:experimental] = true
end

opts.on("--doctor", "Run troubleshooting steps") do
options[:doctor] = true
end

opts.on("-h", "--help", "Print this help") do
puts opts.help
puts
Expand Down Expand Up @@ -107,4 +111,25 @@ if options[:time_index]
return
end

if options[:doctor]
if File.exist?(".index.yml")
begin
config = YAML.parse_file(".index.yml").to_ruby
rescue => e
abort("Error parsing config: #{e.message}")
end
RubyIndexer.configuration.apply_config(config)
end

index = RubyIndexer::Index.new

puts "Globbing for indexable files"

RubyIndexer.configuration.indexables.each do |indexable|
puts "indexing: #{indexable.full_path}"
index.index_single(indexable)
end
return
end

RubyLsp::Server.new.start
23 changes: 0 additions & 23 deletions exe/ruby-lsp-doctor

This file was deleted.

2 changes: 1 addition & 1 deletion ruby-lsp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |s|

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

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

0 comments on commit cbb0f01

Please sign in to comment.