-
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathOutOfProcService.cs
More file actions
39 lines (32 loc) · 1.53 KB
/
OutOfProcService.cs
File metadata and controls
39 lines (32 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using CodeNav.OutOfProc.Helpers;
using Microsoft.ServiceHub.Framework;
using Microsoft.VisualStudio.Extensibility;
using Microsoft.VisualStudio.Extensibility.Shell;
namespace CodeNav.OutOfProc.Services;
[VisualStudioContribution]
internal class OutOfProcService : IOutOfProcService, IBrokeredService
{
private readonly VisualStudioExtensibility _extensibility;
private readonly CodeDocumentService _codeDocumentService;
public OutOfProcService(
VisualStudioExtensibility extensibility,
CodeDocumentService codeDocumentService)
{
_extensibility = extensibility;
_codeDocumentService = codeDocumentService;
}
public static BrokeredServiceConfiguration BrokeredServiceConfiguration
=> new(IOutOfProcService.Configuration.ServiceName, IOutOfProcService.Configuration.ServiceVersion, typeof(OutOfProcService))
{
ServiceAudience = BrokeredServiceAudience.Local | BrokeredServiceAudience.Public,
};
public static ServiceRpcDescriptor ServiceDescriptor => IOutOfProcService.Configuration.ServiceDescriptor;
public async Task SetCodeItemIsExpanded(int spanStart, int spanEnd, bool isExpanded)
{
OutliningHelper.SetIsExpanded(_codeDocumentService.CodeDocumentViewModel, spanStart, spanEnd, isExpanded);
}
public async Task DoSomethingAsync(CancellationToken cancellationToken)
{
await _extensibility.Shell().ShowPromptAsync("Hello from in-proc! (Showing this message from (out-of-proc)", PromptOptions.OK, cancellationToken);
}
}