diff --git a/lib/spoom/sorbet/lsp/structures.rb b/lib/spoom/sorbet/lsp/structures.rb index 35717359..c407d01f 100644 --- a/lib/spoom/sorbet/lsp/structures.rb +++ b/lib/spoom/sorbet/lsp/structures.rb @@ -13,35 +13,6 @@ module PrintableSymbol def accept_printer(printer) = raise NotImplementedError, "Abstract method called" end - class Hover < T::Struct - include PrintableSymbol - - const :contents, String - const :range, T.nilable(Range) - - class << self - #: (Hash[untyped, untyped] json) -> Hover - def from_json(json) - Hover.new( - contents: json["contents"]["value"], - range: json["range"] ? Range.from_json(json["range"]) : nil, - ) - end - end - - # @override - #: (SymbolPrinter printer) -> void - def accept_printer(printer) - printer.print("#{contents}\n") - printer.print_object(range) if range - end - - #: -> String - def to_s - "#{contents} (#{range})." - end - end - class Position < T::Struct include PrintableSymbol @@ -100,6 +71,35 @@ def to_s end end + class Hover < T::Struct + include PrintableSymbol + + const :contents, String + const :range, T.nilable(Range) + + class << self + #: (Hash[untyped, untyped] json) -> Hover + def from_json(json) + Hover.new( + contents: json["contents"]["value"], + range: json["range"] ? Range.from_json(json["range"]) : nil, + ) + end + end + + # @override + #: (SymbolPrinter printer) -> void + def accept_printer(printer) + printer.print("#{contents}\n") + printer.print_object(range) if range + end + + #: -> String + def to_s + "#{contents} (#{range})." + end + end + class Location < T::Struct include PrintableSymbol diff --git a/rbi/spoom.rbi b/rbi/spoom.rbi index 10d9b27c..ea216e3d 100644 --- a/rbi/spoom.rbi +++ b/rbi/spoom.rbi @@ -1836,7 +1836,7 @@ class Spoom::LSP::Hover < ::T::Struct include ::Spoom::LSP::PrintableSymbol const :contents, ::String - const :range, T.nilable(T::Range[T.untyped]) + const :range, T.nilable(::Spoom::LSP::Range) sig { override.params(printer: ::Spoom::LSP::SymbolPrinter).void } def accept_printer(printer); end