Class: LSP::Hover

Inherits:
LSPBase show all
Defined in:
lib/lsp/lsp_types.rb

Overview

export interface Hover

/**
 * The hover's content
 */
contents: MarkupContent | MarkedString | MarkedString[];
/**
 * An optional range
 */
range?: Range;

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ Hover

Returns a new instance of Hover.



921
922
923
924
# File 'lib/lsp/lsp_types.rb', line 921

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[range]
end

Instance Attribute Details

#contentsObject

type: MarkupContent | MarkedString | MarkedString[] # type: Range



919
920
921
# File 'lib/lsp/lsp_types.rb', line 919

def contents
  @contents
end

#rangeObject

type: MarkupContent | MarkedString | MarkedString[] # type: Range



919
920
921
# File 'lib/lsp/lsp_types.rb', line 919

def range
  @range
end

Instance Method Details

#from_h!(value) ⇒ Object



926
927
928
929
930
931
# File 'lib/lsp/lsp_types.rb', line 926

def from_h!(value)
  value = {} if value.nil?
  self.contents = value['contents'] # Unknown type
  self.range = Range.new(value['range']) unless value['range'].nil?
  self
end