Sha256: 41a1c5c1398f2480fdd9f1f39dbf63399c8fb2d2e620e20d771650de4f30038c
Contents?: true
Size: 1.08 KB
Versions: 40
Compression:
Stored size: 1.08 KB
Contents
# typed: strict # frozen_string_literal: true module RubyLsp module ResponseBuilders class Hover < ResponseBuilder ResponseType = type_member { { fixed: String } } extend T::Sig extend T::Generic sig { void } def initialize super @response = T.let( { title: +"", links: +"", documentation: +"", }, T::Hash[Symbol, String], ) end sig { params(content: String, category: Symbol).void } def push(content, category:) hover_content = @response[category] if hover_content hover_content << content + "\n" end end sig { returns(T::Boolean) } def empty? @response.values.all?(&:empty?) end sig { override.returns(ResponseType) } def response result = T.must(@response[:title]) result << "\n" << @response[:links] if @response[:links] result << "\n" << @response[:documentation] if @response[:documentation] result.strip end end end end
Version data entries
40 entries across 40 versions & 1 rubygems