class LanguageServer::Protocol::Interface::FoldingRange

Represents a folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document. Clients are free to ignore invalid ranges.

Attributes

attributes[R]

Public Class Methods

new(start_line:, start_character: nil, end_line:, end_character: nil, kind: nil) click to toggle source
# File lib/language_server/protocol/interface/folding_range.rb, line 10
def initialize(start_line:, start_character: nil, end_line:, end_character: nil, kind: nil)
  @attributes = {}

  @attributes[:startLine] = start_line
  @attributes[:startCharacter] = start_character if start_character
  @attributes[:endLine] = end_line
  @attributes[:endCharacter] = end_character if end_character
  @attributes[:kind] = kind if kind

  @attributes.freeze
end

Public Instance Methods

end_character() click to toggle source

The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.

@return [number]

# File lib/language_server/protocol/interface/folding_range.rb, line 56
def end_character
  attributes.fetch(:endCharacter)
end
end_line() click to toggle source

The zero-based end line of the range to fold. The folded area ends with the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document.

@return [number]

# File lib/language_server/protocol/interface/folding_range.rb, line 47
def end_line
  attributes.fetch(:endLine)
end
kind() click to toggle source

Describes the kind of the folding range such as `comment` or `region`. The kind is used to categorize folding ranges and used by commands like 'Fold all comments'. See [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds.

@return [string]

# File lib/language_server/protocol/interface/folding_range.rb, line 67
def kind
  attributes.fetch(:kind)
end
start_character() click to toggle source

The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.

@return [number]

# File lib/language_server/protocol/interface/folding_range.rb, line 37
def start_character
  attributes.fetch(:startCharacter)
end
start_line() click to toggle source

The zero-based start line of the range to fold. The folded area starts after the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document.

@return [number]

# File lib/language_server/protocol/interface/folding_range.rb, line 28
def start_line
  attributes.fetch(:startLine)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/folding_range.rb, line 73
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/folding_range.rb, line 77
def to_json(*args)
  to_hash.to_json(*args)
end