Class: LanguageServer::Protocol::Interface::InlineValueVariableLookup

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/inline_value_variable_lookup.rb

Overview

Provide inline value through a variable lookup. If only a range is specified, the variable name will be extracted from the underlying document. An optional variable name can be used to override the extracted name.

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(range:, variable_name: nil, case_sensitive_lookup:) ⇒ InlineValueVariableLookup

Returns a new instance of InlineValueVariableLookup.

Since:

  • 3.17.0



12
13
14
15
16
17
18
19
20
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 12

def initialize(range:, variable_name: nil, case_sensitive_lookup:)
  @attributes = {}

  @attributes[:range] = range
  @attributes[:variableName] = variable_name if variable_name
  @attributes[:caseSensitiveLookup] = case_sensitive_lookup

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.17.0



47
48
49
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 47

def attributes
  @attributes
end

Instance Method Details

#case_sensitive_lookupboolean

How to perform the lookup.

Returns:

  • (boolean)

Since:

  • 3.17.0



43
44
45
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 43

def case_sensitive_lookup
  attributes.fetch(:caseSensitiveLookup)
end

#rangeRange

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

Returns:

Since:

  • 3.17.0



27
28
29
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 27

def range
  attributes.fetch(:range)
end

#to_hashObject

Since:

  • 3.17.0



49
50
51
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 49

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.17.0



53
54
55
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 53

def to_json(*args)
  to_hash.to_json(*args)
end

#variable_namestring | nil

If specified the name of the variable to look up.

Returns:

  • (string | nil)

Since:

  • 3.17.0



35
36
37
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 35

def variable_name
  attributes.fetch(:variableName)
end