def call(file_path:)
absolute_target = if Pathname.new(file_path).absolute?
file_path
else
File.join(@root_path, file_path)
end
return file_not_found_response(file_path) unless File.exist?(absolute_target)
document = document_for_path(file_path)
return file_not_found_response(file_path) unless document
declarations = document.definitions.filter_map do |definition|
declaration = definition.declaration
next unless declaration
{
name: declaration.name,
kind: declaration_kind(declaration),
line: definition.location.to_display.start_line,
}
end
response(file: format_path(document.uri), declarations: declarations)
end