Class: LanguageServer::Protocol::Interface::Position
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::Position
- Defined in:
- lib/language_server/protocol/interface/position.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#character ⇒ number
Character offset on a line in a document (zero-based).
-
#initialize(line:, character:) ⇒ Position
constructor
A new instance of Position.
-
#line ⇒ number
Line position in a document (zero-based).
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(line:, character:) ⇒ Position
Returns a new instance of Position.
5 6 7 8 9 10 11 12 |
# File 'lib/language_server/protocol/interface/position.rb', line 5 def initialize(line:, character:) @attributes = {} @attributes[:line] = line @attributes[:character] = character @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
34 35 36 |
# File 'lib/language_server/protocol/interface/position.rb', line 34 def attributes @attributes end |
Instance Method Details
#character ⇒ number
Character offset on a line in a document (zero-based). The meaning of this offset is determined by the negotiated ‘PositionEncodingKind`.
If the character value is greater than the line length it defaults back to the line length.
30 31 32 |
# File 'lib/language_server/protocol/interface/position.rb', line 30 def character attributes.fetch(:character) end |
#line ⇒ number
Line position in a document (zero-based).
18 19 20 |
# File 'lib/language_server/protocol/interface/position.rb', line 18 def line attributes.fetch(:line) end |
#to_hash ⇒ Object
36 37 38 |
# File 'lib/language_server/protocol/interface/position.rb', line 36 def to_hash attributes end |
#to_json(*args) ⇒ Object
40 41 42 |
# File 'lib/language_server/protocol/interface/position.rb', line 40 def to_json(*args) to_hash.to_json(*args) end |