Class: LanguageServer::Protocol::Interface::InlineValue
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::InlineValue
- Defined in:
- lib/language_server/protocol/interface/inline_value.rb,
sig/language_server/protocol/interface/inline_value.rbs
Overview
Inline value information can be provided by different means:
- directly as a text value (class InlineValueText).
- as a name to use for a variable lookup (class InlineValueVariableLookup)
- as an evaluatable expression (class InlineValueEvaluatableExpression) The InlineValue types combines all inline value types into one type.
Instance Attribute Summary collapse
- #attributes ⇒ Hash[Symbol, untyped] readonly
Instance Method Summary collapse
-
#case_sensitive_lookup ⇒ boolean
How to perform the lookup.
-
#expression ⇒ string
If specified the expression overrides the extracted expression.
-
#initialize(range:, text: nil, variable_name: nil, case_sensitive_lookup: nil, expression: nil) ⇒ InlineValue
constructor
A new instance of InlineValue.
-
#range ⇒ Range
The document range for which the inline value applies.
-
#text ⇒ string
The text of the inline value.
- #to_hash ⇒ Hash[Symbol, untyped]
- #to_json(*args) ⇒ String
-
#variable_name ⇒ string
If specified the name of the variable to look up.
Constructor Details
#initialize(range:, text: nil, variable_name: nil, case_sensitive_lookup: nil, expression: nil) ⇒ InlineValue
Returns a new instance of InlineValue.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/language_server/protocol/interface/inline_value.rb', line 14 def initialize(range:, text: nil, variable_name: nil, case_sensitive_lookup: nil, expression: nil) @attributes = {} @attributes[:range] = range @attributes[:text] = text if text @attributes[:variableName] = variable_name if variable_name @attributes[:caseSensitiveLookup] = case_sensitive_lookup if case_sensitive_lookup @attributes[:expression] = expression if expression @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Hash[Symbol, untyped] (readonly)
76 77 78 |
# File 'lib/language_server/protocol/interface/inline_value.rb', line 76 def attributes @attributes end |
Instance Method Details
#case_sensitive_lookup ⇒ boolean
How to perform the lookup.
64 65 66 |
# File 'lib/language_server/protocol/interface/inline_value.rb', line 64 def case_sensitive_lookup attributes.fetch(:caseSensitiveLookup) end |
#expression ⇒ string
If specified the expression overrides the extracted expression.
72 73 74 |
# File 'lib/language_server/protocol/interface/inline_value.rb', line 72 def expression attributes.fetch(:expression) end |
#range ⇒ Range
The document range for which the inline value applies.
--- OR ---
The document range for which the inline value applies. The range is used to extract the variable name from the underlying document.
--- OR ---
The document range for which the inline value applies. The range is used to extract the evaluatable expression from the underlying document.
40 41 42 |
# File 'lib/language_server/protocol/interface/inline_value.rb', line 40 def range attributes.fetch(:range) end |
#text ⇒ string
The text of the inline value.
48 49 50 |
# File 'lib/language_server/protocol/interface/inline_value.rb', line 48 def text attributes.fetch(:text) end |
#to_hash ⇒ Hash[Symbol, untyped]
78 79 80 |
# File 'lib/language_server/protocol/interface/inline_value.rb', line 78 def to_hash attributes end |
#to_json(*args) ⇒ String
82 83 84 |
# File 'lib/language_server/protocol/interface/inline_value.rb', line 82 def to_json(*args) to_hash.to_json(*args) end |
#variable_name ⇒ string
If specified the name of the variable to look up.
56 57 58 |
# File 'lib/language_server/protocol/interface/inline_value.rb', line 56 def variable_name attributes.fetch(:variableName) end |