Class: LanguageServer::Protocol::Interface::DocumentHighlight
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::DocumentHighlight
- Defined in:
- lib/language_server/protocol/interface/document_highlight.rb
Overview
A document highlight is a range inside a text document which deserves special attention. Usually a document highlight is visualized by changing the background color of its range.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(range:, kind: nil) ⇒ DocumentHighlight
constructor
A new instance of DocumentHighlight.
-
#kind ⇒ DocumentHighlightKind
The highlight kind, default is DocumentHighlightKind.Text.
-
#range ⇒ Range
The range this highlight applies to.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(range:, kind: nil) ⇒ DocumentHighlight
Returns a new instance of DocumentHighlight.
10 11 12 13 14 15 16 17 |
# File 'lib/language_server/protocol/interface/document_highlight.rb', line 10 def initialize(range:, kind: nil) @attributes = {} @attributes[:range] = range @attributes[:kind] = kind if kind @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
35 36 37 |
# File 'lib/language_server/protocol/interface/document_highlight.rb', line 35 def attributes @attributes end |
Instance Method Details
#kind ⇒ DocumentHighlightKind
The highlight kind, default is DocumentHighlightKind.Text.
31 32 33 |
# File 'lib/language_server/protocol/interface/document_highlight.rb', line 31 def kind attributes.fetch(:kind) end |
#range ⇒ Range
The range this highlight applies to.
23 24 25 |
# File 'lib/language_server/protocol/interface/document_highlight.rb', line 23 def range attributes.fetch(:range) end |
#to_hash ⇒ Object
37 38 39 |
# File 'lib/language_server/protocol/interface/document_highlight.rb', line 37 def to_hash attributes end |
#to_json(*args) ⇒ Object
41 42 43 |
# File 'lib/language_server/protocol/interface/document_highlight.rb', line 41 def to_json(*args) to_hash.to_json(*args) end |