Class: Rigor::LanguageServer::SynchronizedWriter
- Inherits:
-
Object
- Object
- Rigor::LanguageServer::SynchronizedWriter
- Defined in:
- lib/rigor/language_server/synchronized_writer.rb
Overview
Wraps the LSP gem’s ‘Io::Writer` with a Mutex so concurrent writes (the dispatch loop’s response writes + the Debouncer’s async ‘publishDiagnostics` writes) don’t interleave on the shared STDOUT.
Pass-through proxy: ‘#write(message)` is the only call site the rest of the LSP uses; `#close` is forwarded for completeness.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(inner) ⇒ SynchronizedWriter
constructor
A new instance of SynchronizedWriter.
- #write(message) ⇒ Object
Constructor Details
#initialize(inner) ⇒ SynchronizedWriter
Returns a new instance of SynchronizedWriter.
14 15 16 17 |
# File 'lib/rigor/language_server/synchronized_writer.rb', line 14 def initialize(inner) @inner = inner @mutex = Mutex.new end |
Instance Method Details
#close ⇒ Object
23 24 25 |
# File 'lib/rigor/language_server/synchronized_writer.rb', line 23 def close @mutex.synchronize { @inner.close } end |
#write(message) ⇒ Object
19 20 21 |
# File 'lib/rigor/language_server/synchronized_writer.rb', line 19 def write() @mutex.synchronize { @inner.write() } end |