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.

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.



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

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)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#case_sensitive_lookupboolean

How to perform the lookup.

Returns:

  • (boolean)


45
46
47
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 45

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:



29
30
31
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 29

def range
  attributes.fetch(:range)
end

#to_hashObject



51
52
53
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 51

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



55
56
57
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 55

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

#variable_namestring

If specified the name of the variable to look up.

Returns:

  • (string)


37
38
39
# File 'lib/language_server/protocol/interface/inline_value_variable_lookup.rb', line 37

def variable_name
  attributes.fetch(:variableName)
end