Sha256: c1f974a7615c59e106f9cce38dae03afd9cd03c8bd7c0f771f397dab3a862e70
Contents?: true
Size: 919 Bytes
Versions: 8
Compression:
Stored size: 919 Bytes
Contents
require "json" module LanguageServer module Protocol module Transport module Stdio class Reader def read(&block) buffer = "" header_parsed = false content_length = nil while char = STDIN.getc buffer << char unless header_parsed if buffer[-4..-1] == "\r\n" * 2 content_length = buffer.match(/Content-Length: (\d+)/i)[1].to_i header_parsed = true buffer.clear end else if buffer.bytesize == content_length request = JSON.parse(buffer, symbolize_names: true) block.call(request) header_parsed = false buffer.clear end end end end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems