Sha256: 6291fcec5ae4dfb922265231617263003b8ba5992bbbff54e1731648f0cef454
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
module Yoda class Server class Notifier # @param server [Server] def initialize(server) @server = server end # @param params [Hash] def event(params) server.send_notification(method: 'telemetry/event', params: params) end # @param type [String, Symbol] # @param message [String] def show_message(type:, message:) server.send_notification( method: 'window/showMessage', params: LanguageServer::Protocol::Interface::ShowMessageParams.new( type: message_type(type), message: message, ) ) end # @param type [String, Symbol] # @param message [String] def log_message(type:, message:) server.send_notification( method: 'window/logMessage', params: LanguageServer::Protocol::Interface::ShowMessageParams.new( type: message_type(type), message: message, ) ) end private # @param type [String, Symbol] def message_type(type) case type.to_sym when :error LanguageServer::Protocol::Constant::MessageType::ERROR when :warning LanguageServer::Protocol::Constant::MessageType::WARNING when :info LanguageServer::Protocol::Constant::MessageType::INFO when :log LanguageServer::Protocol::Constant::MessageType::LOG else Logger.warn("#{type} is not valie message type") LanguageServer::Protocol::Constant::MessageType::INFO end end # @return [Server] attr_reader :server end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yoda-language-server-0.6.1 | lib/yoda/server/notifier.rb |
yoda-language-server-0.6.0 | lib/yoda/server/notifier.rb |