Class: LanguageServer::Protocol::Interface::Range
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::Range
- Defined in:
- lib/language_server/protocol/interface/range.rb
Overview
A range in a text document expressed as (zero-based) start and end positions.
If you want to specify a range that contains a line including the line ending character(s) then use an end position denoting the start of the next line. For example: “‘ts {
start: { line: 5, character: 23 }
end : { line 6, character : 0 }
} “‘
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#end ⇒ Position
The range’s end position.
-
#initialize(start:, end:) ⇒ Range
constructor
A new instance of Range.
-
#start ⇒ Position
The range’s start position.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(start:, end:) ⇒ Range
Returns a new instance of Range.
18 19 20 21 22 23 24 25 |
# File 'lib/language_server/protocol/interface/range.rb', line 18 def initialize(start:, end:) @attributes = {} @attributes[:start] = start @attributes[:end] = binding.local_variable_get(:end) @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
43 44 45 |
# File 'lib/language_server/protocol/interface/range.rb', line 43 def attributes @attributes end |
Instance Method Details
#end ⇒ Position
The range’s end position.
39 40 41 |
# File 'lib/language_server/protocol/interface/range.rb', line 39 def end attributes.fetch(:end) end |
#start ⇒ Position
The range’s start position.
31 32 33 |
# File 'lib/language_server/protocol/interface/range.rb', line 31 def start attributes.fetch(:start) end |
#to_hash ⇒ Object
45 46 47 |
# File 'lib/language_server/protocol/interface/range.rb', line 45 def to_hash attributes end |
#to_json(*args) ⇒ Object
49 50 51 |
# File 'lib/language_server/protocol/interface/range.rb', line 49 def to_json(*args) to_hash.to_json(*args) end |