Class: LanguageServer::Protocol::Interface::FoldingRange
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::FoldingRange
- Defined in:
- lib/language_server/protocol/interface/folding_range.rb
Overview
Represents a folding range.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#end_character ⇒ number
The zero-based character offset before the folded range ends.
-
#end_line ⇒ number
The zero-based line number where the folded range ends.
-
#initialize(start_line:, start_character: nil, end_line:, end_character: nil, kind: nil) ⇒ FoldingRange
constructor
A new instance of FoldingRange.
-
#kind ⇒ string
Describes the kind of the folding range such as ‘comment’ or ‘region’.
-
#start_character ⇒ number
The zero-based character offset from where the folded range starts.
-
#start_line ⇒ number
The zero-based line number from where the folded range starts.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(start_line:, start_character: nil, end_line:, end_character: nil, kind: nil) ⇒ FoldingRange
Returns a new instance of FoldingRange.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/language_server/protocol/interface/folding_range.rb', line 8 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 |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
62 63 64 |
# File 'lib/language_server/protocol/interface/folding_range.rb', line 62 def attributes @attributes end |
Instance Method Details
#end_character ⇒ number
The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
48 49 50 |
# File 'lib/language_server/protocol/interface/folding_range.rb', line 48 def end_character attributes.fetch(:endCharacter) end |
#end_line ⇒ number
The zero-based line number where the folded range ends.
40 41 42 |
# File 'lib/language_server/protocol/interface/folding_range.rb', line 40 def end_line attributes.fetch(:endLine) end |
#kind ⇒ string
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.
58 59 60 |
# File 'lib/language_server/protocol/interface/folding_range.rb', line 58 def kind attributes.fetch(:kind) end |
#start_character ⇒ number
The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
32 33 34 |
# File 'lib/language_server/protocol/interface/folding_range.rb', line 32 def start_character attributes.fetch(:startCharacter) end |
#start_line ⇒ number
The zero-based line number from where the folded range starts.
24 25 26 |
# File 'lib/language_server/protocol/interface/folding_range.rb', line 24 def start_line attributes.fetch(:startLine) end |
#to_hash ⇒ Object
64 65 66 |
# File 'lib/language_server/protocol/interface/folding_range.rb', line 64 def to_hash attributes end |
#to_json(*args) ⇒ Object
68 69 70 |
# File 'lib/language_server/protocol/interface/folding_range.rb', line 68 def to_json(*args) to_hash.to_json(*args) end |