Class: Yoda::Server::Notifier
- Inherits:
-
Object
- Object
- Yoda::Server::Notifier
- Defined in:
- lib/yoda/server/notifier.rb
Instance Method Summary collapse
- #busy(type:, id: nil) ⇒ Object
- #event(params) ⇒ Object
-
#initialize(writer) ⇒ Notifier
constructor
A new instance of Notifier.
- #log_message(type:, message:) ⇒ Object
- #show_message(type:, message:) ⇒ Object
Constructor Details
#initialize(writer) ⇒ Notifier
Returns a new instance of Notifier.
5 6 7 |
# File 'lib/yoda/server/notifier.rb', line 5 def initialize(writer) @writer = writer end |
Instance Method Details
#busy(type:, id: nil) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/yoda/server/notifier.rb', line 10 def busy(type:, id: nil) event(type: type, phase: :begin, id: id) yield ensure event(type: type, phase: :end, id: id) end |
#event(params) ⇒ Object
18 19 20 |
# File 'lib/yoda/server/notifier.rb', line 18 def event(params) write(method: 'telemetry/event', params: params) end |
#log_message(type:, message:) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/yoda/server/notifier.rb', line 36 def (type:, message:) write( method: 'window/logMessage', params: LanguageServer::Protocol::Interface::ShowMessageParams.new( type: (type), message: , ) ) end |
#show_message(type:, message:) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/yoda/server/notifier.rb', line 24 def (type:, message:) write( method: 'window/showMessage', params: LanguageServer::Protocol::Interface::ShowMessageParams.new( type: (type), message: , ) ) end |