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
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#expression ⇒ string
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.
13 14 15 16 17 18 19 20 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 13 def initialize(range:, expression: nil) @attributes = {} @attributes[:range] = range @attributes[:expression] = expression if expression @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
40 41 42 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 40 def attributes @attributes end |
Instance Method Details
#expression ⇒ string
If specified the expression overrides the extracted expression.
36 37 38 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 36 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.
28 29 30 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 28 def range attributes.fetch(:range) end |
#to_hash ⇒ Object
42 43 44 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 42 def to_hash attributes end |
#to_json(*args) ⇒ Object
46 47 48 |
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 46 def to_json(*args) to_hash.to_json(*args) end |