Module: Requests::TextDocument::FindReferences

Extended by:
FindReferences
Included in:
FindReferences
Defined in:
lib/holistic/language_server/requests/text_document/find_references.rb

Overview

Instance Method Summary collapse

Instance Method Details

#call(request) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/holistic/language_server/requests/text_document/find_references.rb', line 8

def call(request)
  cursor = build_cursor_from_params(request)

  request.application.unsaved_documents.find(cursor.file_path)&.then do |unsaved_document|
    if unsaved_document.has_unsaved_changes?
      ::Holistic::Ruby::Parser::LiveEditing::ProcessFileChanged.call(
        application: request.application,
        file_path: unsaved_document.path,
        content: unsaved_document.content
      )
    end
  end

  case ::Holistic::Ruby::Scope::ListReferences.call(application: request.application, cursor:)
  in :not_found
    request.respond_with(nil)
  in [:references_listed, {references:}]
    respond_with_locations(request, references)
  end
end