Class: LSP::LocationLink

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

Overview

export interface LocationLink

/**
 * Span of the origin of this link.
 *
 * Used as the underlined span for mouse definition hover. Defaults to the word range at
 * the definition position.
 */
originSelectionRange?: Range;
/**
 * The target resource identifier of this link.
 */
targetUri: DocumentUri;
/**
 * The full target range of this link. If the target for example is a symbol then target range is the
 * range enclosing this symbol not including leading/trailing whitespace but everything else
 * like comments. This information is typically used to highlight the range in the editor.
 */
targetRange: Range;
/**
 * The range that should be selected and revealed when this link is being followed, e.g the name of a function.
 * Must be contained by the the `targetRange`. See also `DocumentSymbol#range`
 */
targetSelectionRange: Range;

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ LocationLink

Returns a new instance of LocationLink.



103
104
105
106
# File 'lib/lsp/lsp_types.rb', line 103

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

Instance Attribute Details

#originSelectionRangeObject

type: Range # type: DocumentUri # type: Range # type: Range



101
102
103
# File 'lib/lsp/lsp_types.rb', line 101

def originSelectionRange
  @originSelectionRange
end

#targetRangeObject

type: Range # type: DocumentUri # type: Range # type: Range



101
102
103
# File 'lib/lsp/lsp_types.rb', line 101

def targetRange
  @targetRange
end

#targetSelectionRangeObject

type: Range # type: DocumentUri # type: Range # type: Range



101
102
103
# File 'lib/lsp/lsp_types.rb', line 101

def targetSelectionRange
  @targetSelectionRange
end

#targetUriObject

type: Range # type: DocumentUri # type: Range # type: Range



101
102
103
# File 'lib/lsp/lsp_types.rb', line 101

def targetUri
  @targetUri
end

Instance Method Details

#from_h!(value) ⇒ Object



108
109
110
111
112
113
114
115
# File 'lib/lsp/lsp_types.rb', line 108

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