Sha256: 8899be4d1daf08013e5e69ec155012e142eeec9e04a743f11a9cb1f286005e1a

Contents?: true

Size: 1.5 KB

Versions: 28

Compression:

Stored size: 1.5 KB

Contents

module Steep
  module Drivers
    class Worker
      attr_reader :stdout, :stderr, :stdin

      attr_accessor :steepfile_path
      attr_accessor :worker_type
      attr_accessor :worker_name

      include Utils::DriverHelper

      def initialize(stdout:, stderr:, stdin:)
        @stdout = stdout
        @stderr = stderr
        @stdin = stdin
      end

      def run()
        Steep.logger.tagged("#{worker_type}:#{worker_name}") do
          project = load_config()

          loader = Project::FileLoader.new(project: project)
          loader.load_sources([])
          loader.load_signatures()

          reader = LanguageServer::Protocol::Transport::Io::Reader.new(stdin)
          writer = LanguageServer::Protocol::Transport::Io::Writer.new(stdout)

          worker = case worker_type
                   when :code
                     Server::CodeWorker.new(project: project, reader: reader, writer: writer)
                   when :signature
                     Server::SignatureWorker.new(project: project, reader: reader, writer: writer)
                   when :interaction
                     Server::InteractionWorker.new(project: project, reader: reader, writer: writer)
                   else
                     raise "Unknown worker type: #{worker_type}"
                   end

          Steep.logger.info "Starting #{worker_type} worker..."

          worker.run()
        rescue Interrupt
          Steep.logger.info "Shutting down by interrupt..."
        end

        0
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
steep-0.39.0 lib/steep/drivers/worker.rb
steep-0.38.0 lib/steep/drivers/worker.rb
steep-0.37.0 lib/steep/drivers/worker.rb
steep-0.36.0 lib/steep/drivers/worker.rb
steep-0.35.0 lib/steep/drivers/worker.rb
steep-0.34.0 lib/steep/drivers/worker.rb
steep-0.33.0 lib/steep/drivers/worker.rb
steep-0.32.0 lib/steep/drivers/worker.rb
steep-0.31.1 lib/steep/drivers/worker.rb
steep-0.31.0 lib/steep/drivers/worker.rb
steep-0.30.0 lib/steep/drivers/worker.rb
steep-0.29.0 lib/steep/drivers/worker.rb
steep-0.28.0 lib/steep/drivers/worker.rb
steep-0.27.0 lib/steep/drivers/worker.rb
steep-0.25.0 lib/steep/drivers/worker.rb
steep-0.24.0 lib/steep/drivers/worker.rb
steep-0.23.0 lib/steep/drivers/worker.rb
steep-0.22.0 lib/steep/drivers/worker.rb
steep-0.21.0 lib/steep/drivers/worker.rb
steep-0.20.0 lib/steep/drivers/worker.rb