class LanguageServer::Protocol::Interface::CodeActionContext
Contains additional diagnostic information about the context in which a code action is run.
Attributes
attributes[R]
Public Class Methods
new(diagnostics:, only: nil, trigger_kind: nil)
click to toggle source
# File lib/language_server/protocol/interface/code_action_context.rb, line 9 def initialize(diagnostics:, only: nil, trigger_kind: nil) @attributes = {} @attributes[:diagnostics] = diagnostics @attributes[:only] = only if only @attributes[:triggerKind] = trigger_kind if trigger_kind @attributes.freeze end
Public Instance Methods
diagnostics()
click to toggle source
An array of diagnostics known on the client side overlapping the range provided to the ‘textDocument/codeAction` request. They are provided so that the server knows which errors are currently presented to the user for the given range. There is no guarantee that these accurately reflect the error state of the resource. The primary parameter to compute code actions is the provided range.
@return [Diagnostic
# File lib/language_server/protocol/interface/code_action_context.rb, line 28 def diagnostics attributes.fetch(:diagnostics) end
only()
click to toggle source
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.
@return [string
# File lib/language_server/protocol/interface/code_action_context.rb, line 39 def only attributes.fetch(:only) end
to_hash()
click to toggle source
# File lib/language_server/protocol/interface/code_action_context.rb, line 53 def to_hash attributes end
to_json(*args)
click to toggle source
# File lib/language_server/protocol/interface/code_action_context.rb, line 57 def to_json(*args) to_hash.to_json(*args) end
trigger_kind()
click to toggle source
The reason why code actions were requested.
@return [CodeActionTriggerKind]
# File lib/language_server/protocol/interface/code_action_context.rb, line 47 def trigger_kind attributes.fetch(:triggerKind) end