lib/ruby_lsp/requests/support/common.rb in ruby-lsp-0.13.4 vs lib/ruby_lsp/requests/support/common.rb in ruby-lsp-0.14.0

- old
+ new

@@ -84,13 +84,13 @@ sig do params( title: String, entries: T.any(T::Array[RubyIndexer::Entry], RubyIndexer::Entry), - ).returns(Interface::MarkupContent) + ).returns(T::Hash[Symbol, String]) end - def markdown_from_index_entries(title, entries) + def categorized_markdown_from_index_entries(title, entries) markdown_title = "```ruby\n#{title}\n```" definitions = [] content = +"" Array(entries).each do |entry| loc = entry.location @@ -106,19 +106,32 @@ definitions << "[#{entry.file_name}](#{uri})" content << "\n\n#{entry.comments.join("\n")}" unless entry.comments.empty? end - Interface::MarkupContent.new( - kind: "markdown", - value: <<~MARKDOWN.chomp, - #{markdown_title} + { + title: markdown_title, + links: "**Definitions**: #{definitions.join(" | ")}", + documentation: content, + } + end - **Definitions**: #{definitions.join(" | ")} + sig do + params( + title: String, + entries: T.any(T::Array[RubyIndexer::Entry], RubyIndexer::Entry), + ).returns(String) + end + def markdown_from_index_entries(title, entries) + categorized_markdown = categorized_markdown_from_index_entries(title, entries) - #{content} - MARKDOWN - ) + <<~MARKDOWN.chomp + #{categorized_markdown[:title]} + + #{categorized_markdown[:links]} + + #{categorized_markdown[:documentation]} + MARKDOWN end end end end end