public Task Handle(DidChangeTextDocumentParams notification) { _router.LogMessage(new LogMessageParams() { Type = MessageType.Log, Message = "Hello World!!!!" }); return(Task.CompletedTask); }
public Task Handle(DidChangeTextDocumentParams notification) { _router.LogMessage(new LogMessageParams() { Type = MessageType.Log, Message = $"CodeFest changing a file {notification.TextDocument.Uri}" }); parser.Update(notification.TextDocument.Uri, notification.ContentChanges.First().Text); return(Task.CompletedTask); }
public static void LogInfo(this ILanguageServer mediator, string message) { mediator.LogMessage(new LogMessageParams() { Type = MessageType.Info, Message = message }); }
/// <summary> /// Emit a log event. /// </summary> /// <param name="logEvent"> /// The log event information. /// </param> public void Emit(LogEvent logEvent) { if (_hasServerShutDown) { return; } if (logEvent.Level < _levelSwitch.MinimumLevel) { return; } LogMessageParams logParameters = new LogMessageParams { Message = logEvent.RenderMessage() }; if (logEvent.Exception != null) { logParameters.Message += "\n" + logEvent.Exception.ToString(); } switch (logEvent.Level) { case LogEventLevel.Error: case LogEventLevel.Fatal: { logParameters.Type = MessageType.Error; break; } case LogEventLevel.Warning: { logParameters.Type = MessageType.Warning; break; } case LogEventLevel.Information: { logParameters.Type = MessageType.Info; break; } default: { logParameters.Type = MessageType.Log; break; } } _languageServer.LogMessage(logParameters); }
public static void Log(this ILanguageServer mediator, LogMessageParams @params) { mediator.LogMessage(@params); }
public static void LogWarning(this ILanguageServer mediator, string message) => mediator.LogMessage(new LogMessageParams { Type = MessageType.Warning, Message = message });
/// <summary> /// Emit a log event. /// </summary> /// <param name="logEvent"> /// The log event information. /// </param> public void Emit(LogEvent logEvent) { if (!CanLog) { return; } if (logEvent.Level < _levelSwitch.MinimumLevel) { return; } StringBuilder messageBuilder = new StringBuilder(); using (StringWriter messageWriter = new StringWriter(messageBuilder)) { logEvent.RenderMessage(messageWriter); } if (logEvent.Exception != null) { messageBuilder.AppendLine(); messageBuilder.Append( logEvent.Exception.ToString() ); } LogMessageParams logParameters = new LogMessageParams { Message = messageBuilder.ToString() }; switch (logEvent.Level) { case LogEventLevel.Error: case LogEventLevel.Fatal: { logParameters.Type = MessageType.Error; break; } case LogEventLevel.Warning: { logParameters.Type = MessageType.Warning; break; } case LogEventLevel.Information: { logParameters.Type = MessageType.Info; break; } default: { logParameters.Type = MessageType.Log; break; } } _languageServer.LogMessage(logParameters); }