Sha256: 209c9a7806816aaddd9a92f6dc181a33f164ec2a388a3677a28417ee99093c78

Contents?: true

Size: 1.36 KB

Versions: 22

Compression:

Stored size: 1.36 KB

Contents

# typed: strict
# frozen_string_literal: true

require "shellwords"

require "ruby_lsp/listeners/code_lens"

module RubyLsp
  module Requests
    # The
    # [code lens](https://microsoft.github.io/language-server-protocol/specification#textDocument_codeLens)
    # request informs the editor of runnable commands such as testing and debugging.
    class CodeLens < Request
      extend T::Sig

      class << self
        extend T::Sig

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

      sig do
        params(
          global_state: GlobalState,
          uri: URI::Generic,
          dispatcher: Prism::Dispatcher,
        ).void
      end
      def initialize(global_state, uri, dispatcher)
        @response_builder = T.let(
          ResponseBuilders::CollectionResponseBuilder[Interface::CodeLens].new,
          ResponseBuilders::CollectionResponseBuilder[Interface::CodeLens],
        )
        super()
        Listeners::CodeLens.new(@response_builder, global_state, uri, dispatcher)

        Addon.addons.each do |addon|
          addon.create_code_lens_listener(@response_builder, uri, dispatcher)
        end
      end

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ruby-lsp-0.23.6 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.23.5 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.23.4 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.23.3 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.23.2 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.23.1 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.23.0 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.22.1 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.22.0 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.21.3 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.21.2 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.21.1 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.21.0 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.20.1 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.20.0 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.19.1 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.19.0 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.18.4 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.18.3 lib/ruby_lsp/requests/code_lens.rb
ruby-lsp-0.18.2 lib/ruby_lsp/requests/code_lens.rb