Class: RubyLsp::Requests::SignatureHelp
- Defined in:
- lib/ruby_lsp/requests/signature_help.rb
Overview
The [signature help request](microsoft.github.io/language-server-protocol/specification#textDocument_signatureHelp) displays information about the parameters of a method as you type an invocation.
Class Method Summary collapse
-
.provider ⇒ Object
: -> Interface::SignatureHelpOptions.
Instance Method Summary collapse
-
#initialize(document, global_state, position, context, dispatcher, sorbet_level) ⇒ SignatureHelp
constructor
: ((RubyDocument | ERBDocument) document, GlobalState global_state, Hash[Symbol, untyped] position, Hash[Symbol, untyped]? context, Prism::Dispatcher dispatcher, SorbetLevel sorbet_level) -> void.
-
#perform ⇒ Object
: -> Interface::SignatureHelp?.
Constructor Details
#initialize(document, global_state, position, context, dispatcher, sorbet_level) ⇒ SignatureHelp
: ((RubyDocument | ERBDocument) document, GlobalState global_state, Hash[Symbol, untyped] position, Hash[Symbol, untyped]? context, Prism::Dispatcher dispatcher, SorbetLevel sorbet_level) -> void
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ruby_lsp/requests/signature_help.rb', line 23 def initialize(document, global_state, position, context, dispatcher, sorbet_level) # rubocop:disable Metrics/ParameterLists super() char_position, _ = document.find_index_by_position(position) delegate_request_if_needed!(global_state, document, char_position) node_context = RubyDocument.locate( document.ast, char_position, node_types: [Prism::CallNode], code_units_cache: document.code_units_cache, ) target = adjust_for_nested_target(node_context.node, node_context.parent, position) @target = target #: Prism::Node? @dispatcher = dispatcher @response_builder = ResponseBuilders::SignatureHelp.new #: ResponseBuilders::SignatureHelp Listeners::SignatureHelp.new(@response_builder, global_state, node_context, dispatcher, sorbet_level) end |
Class Method Details
.provider ⇒ Object
: -> Interface::SignatureHelpOptions
14 15 16 17 18 19 |
# File 'lib/ruby_lsp/requests/signature_help.rb', line 14 def provider # Identifier characters are automatically included, such as A-Z, a-z, 0-9, _, * or : Interface::SignatureHelpOptions.new( trigger_characters: ["(", " ", ","], ) end |
Instance Method Details
#perform ⇒ Object
: -> Interface::SignatureHelp?
46 47 48 49 50 51 |
# File 'lib/ruby_lsp/requests/signature_help.rb', line 46 def perform return unless @target @dispatcher.dispatch_once(@target) @response_builder.response end |