Class: LanguageServer::Protocol::Interface::LocationLink

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/location_link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(origin_selection_range: nil, target_uri:, target_range:, target_selection_range: nil) ⇒ LocationLink

Returns a new instance of LocationLink.



5
6
7
8
9
10
11
12
13
14
# File 'lib/language_server/protocol/interface/location_link.rb', line 5

def initialize(origin_selection_range: nil, target_uri:, target_range:, target_selection_range: nil)
  @attributes = {}

  @attributes[:originSelectionRange] = origin_selection_range if origin_selection_range
  @attributes[:targetUri] = target_uri
  @attributes[:targetRange] = target_range
  @attributes[:targetSelectionRange] = target_selection_range if target_selection_range

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



51
52
53
# File 'lib/language_server/protocol/interface/location_link.rb', line 51

def attributes
  @attributes
end

Instance Method Details

#origin_selection_rangeRange

Span of the origin of this link.

Used as the underlined span for mouse interaction. Defaults to the word range at the mouse position.

Returns:



23
24
25
# File 'lib/language_server/protocol/interface/location_link.rb', line 23

def origin_selection_range
  attributes.fetch(:originSelectionRange)
end

#target_rangeRange

The full target range of this link.

Returns:



39
40
41
# File 'lib/language_server/protocol/interface/location_link.rb', line 39

def target_range
  attributes.fetch(:targetRange)
end

#target_selection_rangeRange

The span of this link.

Returns:



47
48
49
# File 'lib/language_server/protocol/interface/location_link.rb', line 47

def target_selection_range
  attributes.fetch(:targetSelectionRange)
end

#target_uristring

The target resource identifier of this link.

Returns:

  • (string)


31
32
33
# File 'lib/language_server/protocol/interface/location_link.rb', line 31

def target_uri
  attributes.fetch(:targetUri)
end

#to_hashObject



53
54
55
# File 'lib/language_server/protocol/interface/location_link.rb', line 53

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



57
58
59
# File 'lib/language_server/protocol/interface/location_link.rb', line 57

def to_json(*args)
  to_hash.to_json(*args)
end