class LanguageServer::Protocol::Interface::Position

Attributes

attributes[R]

Public Class Methods

new(line:, character:) click to toggle source
# File lib/language_server/protocol/interface/position.rb, line 5
def initialize(line:, character:)
  @attributes = {}

  @attributes[:line] = line
  @attributes[:character] = character

  @attributes.freeze
end

Public Instance Methods

character() click to toggle source

Character offset on a line in a document (zero-based). Assuming that the line is represented as a string, the `character` value represents the gap between the `character` and `character + 1`.

If the character value is greater than the line length it defaults back to the line length.

@return [number]

# File lib/language_server/protocol/interface/position.rb, line 31
def character
  attributes.fetch(:character)
end
line() click to toggle source

Line position in a document (zero-based).

@return [number]

# File lib/language_server/protocol/interface/position.rb, line 18
def line
  attributes.fetch(:line)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/position.rb, line 37
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/position.rb, line 41
def to_json(*args)
  to_hash.to_json(*args)
end