Class: LanguageServer::Protocol::Interface::LocationLink
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::LocationLink
- Defined in:
- lib/language_server/protocol/interface/location_link.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(origin_selection_range: nil, target_uri:, target_range:, target_selection_range:) ⇒ LocationLink
constructor
A new instance of LocationLink.
-
#origin_selection_range ⇒ Range
Span of the origin of this link.
-
#target_range ⇒ Range
The full target range of this link.
-
#target_selection_range ⇒ Range
The range that should be selected and revealed when this link is being followed, e.g the name of a function.
-
#target_uri ⇒ string
The target resource identifier of this link.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(origin_selection_range: nil, target_uri:, target_range:, target_selection_range:) ⇒ 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:) @attributes = {} @attributes[:originSelectionRange] = origin_selection_range if origin_selection_range @attributes[:targetUri] = target_uri @attributes[:targetRange] = target_range @attributes[:targetSelectionRange] = target_selection_range @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
56 57 58 |
# File 'lib/language_server/protocol/interface/location_link.rb', line 56 def attributes @attributes end |
Instance Method Details
#origin_selection_range ⇒ Range
Span of the origin of this link.
Used as the underlined span for mouse interaction. Defaults to the word range at the mouse position.
23 24 25 |
# File 'lib/language_server/protocol/interface/location_link.rb', line 23 def origin_selection_range attributes.fetch(:originSelectionRange) end |
#target_range ⇒ Range
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.
42 43 44 |
# File 'lib/language_server/protocol/interface/location_link.rb', line 42 def target_range attributes.fetch(:targetRange) end |
#target_selection_range ⇒ 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 ‘targetRange`. See also `DocumentSymbol#range`
52 53 54 |
# File 'lib/language_server/protocol/interface/location_link.rb', line 52 def target_selection_range attributes.fetch(:targetSelectionRange) end |
#target_uri ⇒ string
The target resource identifier of this link.
31 32 33 |
# File 'lib/language_server/protocol/interface/location_link.rb', line 31 def target_uri attributes.fetch(:targetUri) end |
#to_hash ⇒ Object
58 59 60 |
# File 'lib/language_server/protocol/interface/location_link.rb', line 58 def to_hash attributes end |
#to_json(*args) ⇒ Object
62 63 64 |
# File 'lib/language_server/protocol/interface/location_link.rb', line 62 def to_json(*args) to_hash.to_json(*args) end |