-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose NotificationService to OmniSharp (#76541)
An implementation of INotificationService is [now required](https://github.com/dotnet/roslyn/pull/76510/files#diff-ee57f8ea8866dad6ed1842766c60de5011571b13c376c524a53301d46714a2f8R268) for GetExtractInterfaceOptions. This change allows OmniSharp to provide a no-op implementation. Also removes the use of WaitAndGetResults from the OmniSharp extract class and interface option services.
- Loading branch information
Showing
8 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/Features/ExternalAccess/OmniSharp/Internal/Notification/OmniSharpNotificationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Composition; | ||
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Notification; | ||
using Microsoft.CodeAnalysis.Host.Mef; | ||
using Microsoft.CodeAnalysis.Notification; | ||
|
||
namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Internal.Notification; | ||
|
||
[ExportWorkspaceService(typeof(INotificationService)), Shared] | ||
[method: ImportingConstructor] | ||
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] | ||
internal sealed class OmniSharpNotificationService( | ||
IOmniSharpNotificationService omniSharpNotificationService) : INotificationService | ||
{ | ||
public bool ConfirmMessageBox(string message, string? title = null, NotificationSeverity severity = NotificationSeverity.Warning) | ||
{ | ||
return omniSharpNotificationService.ConfirmMessageBox(message, title, (OmniSharpNotificationSeverity)severity); | ||
} | ||
|
||
public void SendNotification(string message, string? title = null, NotificationSeverity severity = NotificationSeverity.Warning) | ||
{ | ||
omniSharpNotificationService.SendNotification(message, title, (OmniSharpNotificationSeverity)severity); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Features/ExternalAccess/OmniSharp/Notification/IOmniSharpNotificationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Notification; | ||
|
||
internal interface IOmniSharpNotificationService | ||
{ | ||
/// <summary> | ||
/// Displays a message box with an OK button to the user. | ||
/// </summary> | ||
/// <param name="message">The message shown within the message box.</param> | ||
/// <param name="title">The title bar to be shown in the message box. May be ignored by some implementations.</param> | ||
/// <param name="severity">The severity of the message.</param> | ||
void SendNotification( | ||
string message, | ||
string? title = null, | ||
OmniSharpNotificationSeverity severity = OmniSharpNotificationSeverity.Warning); | ||
|
||
/// <summary> | ||
/// Displays a message box with a yes/no question to the user. | ||
/// </summary> | ||
/// <param name="message">The message shown within the message box.</param> | ||
/// <param name="title">The title bar to be shown in the message box. May be ignored by some implementations.</param> | ||
/// <param name="severity">The severity of the message.</param> | ||
/// <returns>true if yes was clicked, false otherwise.</returns> | ||
bool ConfirmMessageBox( | ||
string message, | ||
string? title = null, | ||
OmniSharpNotificationSeverity severity = OmniSharpNotificationSeverity.Warning); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Features/ExternalAccess/OmniSharp/Notification/OmniSharpNotificationSeverity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CodeAnalysis.Notification; | ||
|
||
namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Notification; | ||
|
||
internal enum OmniSharpNotificationSeverity | ||
{ | ||
Information = NotificationSeverity.Information, | ||
Warning = NotificationSeverity.Warning, | ||
Error = NotificationSeverity.Error | ||
} |