Class: LanguageServer::Protocol::Interface::InlineValueEvaluatableExpression

Inherits:
Object
  • Object
show all
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.

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(range:, expression: nil) ⇒ InlineValueEvaluatableExpression

Returns a new instance of InlineValueEvaluatableExpression.

Since:

  • 3.17.0



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

#attributesObject (readonly)

Since:

  • 3.17.0



38
39
40
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 38

def attributes
  @attributes
end

Instance Method Details

#expressionstring | nil

If specified the expression overrides the extracted expression.

Returns:

  • (string | nil)

Since:

  • 3.17.0



34
35
36
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 34

def expression
  attributes.fetch(:expression)
end

#rangeRange

The document range for which the inline value applies. The range is used to extract the evaluatable expression from the underlying document.

Returns:

Since:

  • 3.17.0



26
27
28
# File 'lib/language_server/protocol/interface/inline_value_evaluatable_expression.rb', line 26

def range
  attributes.fetch(:range)
end

#to_hashObject

Since:

  • 3.17.0



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

Since:

  • 3.17.0



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