Class: LanguageServer::Protocol::Interface::InlineValueEvaluatableExpression
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::InlineValueEvaluatableExpression
- Defined in:
- lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb
Overview
Provide an inline value through an expression evaluation. If only a range is specified, the expression will be extracted from the underlying document. An optional expression can be used to override the extracted expression.
Instance Attribute Summary collapse
- #attributes ⇒ Object readonly
Instance Method Summary collapse
-
#expression ⇒ string | nil
If specified the expression overrides the extracted expression.
-
#initialize(range:, expression: nil) ⇒ InlineValueEvaluatableExpression
constructor
A new instance of InlineValueEvaluatableExpression.
-
#range ⇒ Range
The document range for which the inline value applies.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(range:, expression: nil) ⇒ InlineValueEvaluatableExpression
Returns a new instance of InlineValueEvaluatableExpression.
12 13 14 15 16 17 18 19 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 12 def initialize(range:, expression: nil) @attributes = {} @attributes[:range] = range @attributes[:expression] = expression if expression @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
38 39 40 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 38 def attributes @attributes end |
Instance Method Details
#expression ⇒ string | nil
If specified the expression overrides the extracted expression.
34 35 36 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 34 def expression attributes.fetch(:expression) end |
#range ⇒ Range
The document range for which the inline value applies. The range is used to extract the evaluatable expression from the underlying document.
26 27 28 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 26 def range attributes.fetch(:range) end |
#to_hash ⇒ Object
40 41 42 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 40 def to_hash attributes end |
#to_json(*args) ⇒ Object
44 45 46 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 44 def to_json(*args) to_hash.to_json(*args) end |