Class: LanguageServer::Protocol::Interface::CodeActionContext
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::CodeActionContext
- Defined in:
- lib/language_server/protocol/interface/code_action_context.rb
Overview
Contains additional diagnostic information about the context in which a code action is run.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#diagnostics ⇒ Diagnostic[]
An array of diagnostics.
-
#initialize(diagnostics:, only: nil) ⇒ CodeActionContext
constructor
A new instance of CodeActionContext.
-
#only ⇒ string[]
Requested kind of actions to return.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(diagnostics:, only: nil) ⇒ CodeActionContext
Returns a new instance of CodeActionContext.
9 10 11 12 13 14 15 16 |
# File 'lib/language_server/protocol/interface/code_action_context.rb', line 9 def initialize(diagnostics:, only: nil) @attributes = {} @attributes[:diagnostics] = diagnostics @attributes[:only] = only if only @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
37 38 39 |
# File 'lib/language_server/protocol/interface/code_action_context.rb', line 37 def attributes @attributes end |
Instance Method Details
#diagnostics ⇒ Diagnostic[]
An array of diagnostics.
22 23 24 |
# File 'lib/language_server/protocol/interface/code_action_context.rb', line 22 def diagnostics attributes.fetch(:diagnostics) end |
#only ⇒ string[]
Requested kind of actions to return.
Actions not of this kind are filtered out by the client before being shown. So servers can omit computing them.
33 34 35 |
# File 'lib/language_server/protocol/interface/code_action_context.rb', line 33 def only attributes.fetch(:only) end |
#to_hash ⇒ Object
39 40 41 |
# File 'lib/language_server/protocol/interface/code_action_context.rb', line 39 def to_hash attributes end |
#to_json(*args) ⇒ Object
43 44 45 |
# File 'lib/language_server/protocol/interface/code_action_context.rb', line 43 def to_json(*args) to_hash.to_json(*args) end |