Skip to content

Commit 7f03a73

Browse files
committed
Convert PsesDefinitionHandler to inherit DefinitionHandlerBase
1 parent 35a50ce commit 7f03a73

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

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

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

1919
namespace Microsoft.PowerShell.EditorServices.Handlers
2020
{
21-
internal class PsesDefinitionHandler : IDefinitionHandler
21+
internal class PsesDefinitionHandler : DefinitionHandlerBase
2222
{
2323
private readonly ILogger _logger;
2424
private readonly SymbolsService _symbolsService;
2525
private readonly WorkspaceService _workspaceService;
2626

27-
private DefinitionCapability _capability;
28-
2927
public PsesDefinitionHandler(
3028
ILoggerFactory factory,
3129
SymbolsService symbolsService,
@@ -36,15 +34,12 @@ public PsesDefinitionHandler(
3634
_workspaceService = workspaceService;
3735
}
3836

39-
public DefinitionRegistrationOptions GetRegistrationOptions()
37+
protected override DefinitionRegistrationOptions CreateRegistrationOptions(DefinitionCapability capability, ClientCapabilities clientCapabilities) => new DefinitionRegistrationOptions
4038
{
41-
return new DefinitionRegistrationOptions
42-
{
43-
DocumentSelector = LspUtils.PowerShellDocumentSelector
44-
};
45-
}
39+
DocumentSelector = LspUtils.PowerShellDocumentSelector
40+
};
4641

47-
public async Task<LocationOrLocationLinks> Handle(DefinitionParams request, CancellationToken cancellationToken)
42+
public override async Task<LocationOrLocationLinks> Handle(DefinitionParams request, CancellationToken cancellationToken)
4843
{
4944
ScriptFile scriptFile = _workspaceService.GetFile(request.TextDocument.Uri);
5045

@@ -76,11 +71,6 @@ public async Task<LocationOrLocationLinks> Handle(DefinitionParams request, Canc
7671
return new LocationOrLocationLinks(definitionLocations);
7772
}
7873

79-
public void SetCapability(DefinitionCapability capability)
80-
{
81-
_capability = capability;
82-
}
83-
8474
private static Range GetRangeFromScriptRegion(ScriptRegion scriptRegion)
8575
{
8676
return new Range

0 commit comments

Comments
 (0)