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 ⇒ LSPAny
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.
13 14 15 16 17 18 19 20 21 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 13 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.
49 50 51 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 49 def attributes @attributes end |
Instance Method Details
#command ⇒ Command
The command this code lens represents.
36 37 38 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 36 def command attributes.fetch(:command) end |
#data ⇒ LSPAny
A data entry field that is preserved on a code lens item between a code lens and a code lens resolve request.
45 46 47 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 45 def data attributes.fetch(:data) end |
#range ⇒ Range
The range in which this code lens is valid. Should only span a single line.
28 29 30 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 28 def range attributes.fetch(:range) end |
#to_hash ⇒ Object
51 52 53 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 51 def to_hash attributes end |
#to_json(*args) ⇒ Object
55 56 57 |
# File 'lib/language_server/protocol/interface/code_lens.rb', line 55 def to_json(*args) to_hash.to_json(*args) end |