diff --git a/src/Protocol/Window/IShowMessageHandler.cs b/src/Protocol/Window/IShowMessageHandler.cs index f64a55ffb..a48cacd7f 100644 --- a/src/Protocol/Window/IShowMessageHandler.cs +++ b/src/Protocol/Window/IShowMessageHandler.cs @@ -1,8 +1,10 @@ +using System; using System.Threading; using System.Threading.Tasks; using MediatR; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.JsonRpc.Generation; +using OmniSharp.Extensions.LanguageServer.Protocol.Client; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Server; @@ -16,4 +18,32 @@ public abstract class ShowMessageHandler : IShowMessageHandler { public abstract Task Handle(ShowMessageParams request, CancellationToken cancellationToken); } + + public static partial class ShowMessageExtensions + { + public static void Show(this IWindowLanguageServer mediator, ShowMessageParams @params) + { + mediator.ShowMessage(@params); + } + + public static void ShowError(this IWindowLanguageServer mediator, string message) + { + mediator.ShowMessage(new ShowMessageParams() { Type = MessageType.Error, Message = message }); + } + + public static void Show(this IWindowLanguageServer mediator, string message) + { + mediator.ShowMessage(new ShowMessageParams() { Type = MessageType.Log, Message = message }); + } + + public static void ShowWarning(this IWindowLanguageServer mediator, string message) + { + mediator.ShowMessage(new ShowMessageParams() { Type = MessageType.Warning, Message = message }); + } + + public static void ShowInfo(this IWindowLanguageServer mediator, string message) + { + mediator.ShowMessage(new ShowMessageParams() { Type = MessageType.Info, Message = message }); + } + } }