Sha256: 69aa5733db3b44d0b1cbd1a751f30280e4ea33c89a5b2c3ca5150b5506bd7736

Contents?: true

Size: 995 Bytes

Versions: 3

Compression:

Stored size: 995 Bytes

Contents

# typed: strict
# frozen_string_literal: true

require "ruby_lsp/addon"
require "ruby_lsp/internal"

require_relative "code_lens"

module RubyLsp
  module RSpec
    class Addon < ::RubyLsp::Addon
      extend T::Sig

      sig { override.void }
      def activate; end

      sig { override.void }
      def deactivate; end

      # Creates a new CodeLens listener. This method is invoked on every CodeLens request
      sig do
        override.params(
          uri: URI::Generic,
          emitter: Prism::Dispatcher,
          message_queue: Thread::Queue,
        ).returns(T.nilable(Listener[T::Array[Interface::CodeLens]]))
      end
      def create_code_lens_listener(uri, emitter, message_queue)
        return unless uri.to_standardized_path&.end_with?("_test.rb") || uri.to_standardized_path&.end_with?("_spec.rb")

        CodeLens.new(uri, emitter, message_queue)
      end

      sig { override.returns(String) }
      def name
        "Ruby LSP RSpec"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-lsp-rspec-0.1.7 lib/ruby_lsp/ruby_lsp_rspec/addon.rb
ruby-lsp-rspec-0.1.6 lib/ruby_lsp/ruby_lsp_rspec/addon.rb
ruby-lsp-rspec-0.1.5 lib/ruby_lsp/ruby_lsp_rspec/addon.rb