Sha256: e2942350e4d25e7cfbfd650b3fadc1ecd8d71dae101a5ee7a798f15ee3ec5bbc

Contents?: true

Size: 1.31 KB

Versions: 13

Compression:

Stored size: 1.31 KB

Contents

# typed: strict
# frozen_string_literal: true

require "ruby_lsp/listeners/inlay_hints"

module RubyLsp
  module Requests
    # [Inlay hints](https://microsoft.github.io/language-server-protocol/specification#textDocument_inlayHint)
    # are labels added directly in the code that explicitly show the user something that might
    # otherwise just be implied.
    class InlayHints < Request
      extend T::Sig

      class << self
        extend T::Sig

        sig { returns(Interface::InlayHintOptions) }
        def provider
          Interface::InlayHintOptions.new(resolve_provider: false)
        end
      end

      sig do
        params(
          document: T.any(RubyDocument, ERBDocument),
          hints_configuration: RequestConfig,
          dispatcher: Prism::Dispatcher,
        ).void
      end
      def initialize(document, hints_configuration, dispatcher)
        super()

        @response_builder = T.let(
          ResponseBuilders::CollectionResponseBuilder[Interface::InlayHint].new,
          ResponseBuilders::CollectionResponseBuilder[Interface::InlayHint],
        )
        Listeners::InlayHints.new(@response_builder, hints_configuration, dispatcher)
      end

      sig { override.returns(T::Array[Interface::InlayHint]) }
      def perform
        @response_builder.response
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ruby-lsp-0.22.1 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.22.0 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.21.3 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.21.2 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.21.1 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.21.0 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.20.1 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.20.0 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.19.1 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.19.0 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.18.4 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.18.3 lib/ruby_lsp/requests/inlay_hints.rb
ruby-lsp-0.18.2 lib/ruby_lsp/requests/inlay_hints.rb