Skip to content

Commit

Permalink
Move document fetching to the first document link request call
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Sep 6, 2022
1 parent 37dfaf2 commit 613812f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions lib/ruby_lsp/handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ def initialize
def start
$stderr.puts "Starting Ruby LSP..."

if Requests::DocumentLink::RAILTIES_VERSION
$stderr.puts "Fetching Rails Documents..."
Requests::DocumentLink.fetch_rails_documents
end

@reader.read do |request|
handler = @handlers[request[:method]]
next if handler.nil?
Expand Down
5 changes: 5 additions & 0 deletions lib/ruby_lsp/requests/document_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ def add_rails_document_link(node, name)
# ignore non-Ruby files
return unless @uri.match?(/\.rb$/)

if RAILTIES_VERSION
$stderr.puts "Fetching Rails Documents..."
self.class.fetch_rails_documents
end

doc_path = self.class.rails_documents[name]

if doc_path
Expand Down

0 comments on commit 613812f

Please sign in to comment.