Sha256: ae75836fc0c55e743c43c542916d3fe803dfb4e7c012361e340fc82c1f39c1ee
Contents?: true
Size: 1.29 KB
Versions: 13
Compression:
Stored size: 1.29 KB
Contents
module Steep module Server class BaseWorker LSP = LanguageServer::Protocol include Utils attr_reader :project attr_reader :reader, :writer def initialize(project:, reader:, writer:) @project = project @reader = reader @writer = writer @shutdown = false end def handle_request(request) # process request end def handle_job(job) # process async job end def run tags = Steep.logger.formatter.current_tags.dup thread = Thread.new do Steep.logger.formatter.push_tags(*tags) Steep.logger.tagged "background" do while job = queue.pop handle_job(job) unless @shutdown end end end Steep.logger.tagged "frontend" do begin reader.read do |request| case request[:method] when "shutdown" @shutdown = true writer.write(id: request[:id], result: nil) when "exit" break else handle_request(request) unless @shutdown end end ensure queue << nil thread.join end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems