Class: LanguageServer::Protocol::Interface::CodeLens
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::CodeLens
- Defined in:
- lib/language_server/protocol/interface/code_lens.rb
Overview
A code lens represents a command that should be shown along with source text, like the number of references, a way to run tests, etc.
A code lens is unresolved when no command is associated to it. For performance reasons the creation of a code lens and resolving should be done in two stages.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#command ⇒ Command
The command this code lens represents.
-
#data ⇒ any
A data entry field that is preserved on a code lens item between a code lens and a code lens resolve request.
-
#initialize(range:, command: nil, data: nil) ⇒ CodeLens
constructor
A new instance of CodeLens.
-
#range ⇒ Range
The range in which this code lens is valid.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(range:, command: nil, data: nil) ⇒ CodeLens
Returns a new instance of CodeLens.
12 13 14 15 16 17 18 19 20 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 12 def initialize(range:, command: nil, data: nil) @attributes = {} @attributes[:range] = range @attributes[:command] = command if command @attributes[:data] = data if data @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
47 48 49 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 47 def attributes @attributes end |
Instance Method Details
#command ⇒ Command
The command this code lens represents.
34 35 36 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 34 def command attributes.fetch(:command) end |
#data ⇒ any
A data entry field that is preserved on a code lens item between a code lens and a code lens resolve request.
43 44 45 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 43 def data attributes.fetch(:data) end |
#range ⇒ Range
The range in which this code lens is valid. Should only span a single line.
26 27 28 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 26 def range attributes.fetch(:range) end |
#to_hash ⇒ Object
49 50 51 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 49 def to_hash attributes end |
#to_json(*args) ⇒ Object
53 54 55 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 53 def to_json(*args) to_hash.to_json(*args) end |