Skip to content

Commit c5e6668

Browse files
committed
Convert PsesReferencesHandler to inherit ReferencesHandlerBase
1 parent d02193d commit c5e6668

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/PowerShellEditorServices/Services/TextDocument/Handlers/ReferencesHandler.cs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818

1919
namespace Microsoft.PowerShell.EditorServices.Handlers
2020
{
21-
class PsesReferencesHandler : IReferencesHandler
21+
class PsesReferencesHandler : ReferencesHandlerBase
2222
{
2323
private readonly ILogger _logger;
2424
private readonly SymbolsService _symbolsService;
2525
private readonly WorkspaceService _workspaceService;
26-
private ReferenceCapability _capability;
2726

2827
public PsesReferencesHandler(ILoggerFactory factory, SymbolsService symbolsService, WorkspaceService workspaceService)
2928
{
@@ -32,15 +31,12 @@ public PsesReferencesHandler(ILoggerFactory factory, SymbolsService symbolsServi
3231
_workspaceService = workspaceService;
3332
}
3433

35-
public ReferenceRegistrationOptions GetRegistrationOptions()
34+
protected override ReferenceRegistrationOptions CreateRegistrationOptions(ReferenceCapability capability, ClientCapabilities clientCapabilities) => new ReferenceRegistrationOptions
3635
{
37-
return new ReferenceRegistrationOptions
38-
{
39-
DocumentSelector = LspUtils.PowerShellDocumentSelector
40-
};
41-
}
36+
DocumentSelector = LspUtils.PowerShellDocumentSelector
37+
};
4238

43-
public Task<LocationContainer> Handle(ReferenceParams request, CancellationToken cancellationToken)
39+
public override Task<LocationContainer> Handle(ReferenceParams request, CancellationToken cancellationToken)
4440
{
4541
ScriptFile scriptFile = _workspaceService.GetFile(request.TextDocument.Uri);
4642

@@ -73,11 +69,6 @@ public Task<LocationContainer> Handle(ReferenceParams request, CancellationToken
7369
return Task.FromResult(new LocationContainer(locations));
7470
}
7571

76-
public void SetCapability(ReferenceCapability capability)
77-
{
78-
_capability = capability;
79-
}
80-
8172
private static Range GetRangeFromScriptRegion(ScriptRegion scriptRegion)
8273
{
8374
return new Range

0 commit comments

Comments
 (0)