1717
1818namespace Microsoft . PowerShell . EditorServices . Handlers
1919{
20- internal class PsesDocumentHighlightHandler : IDocumentHighlightHandler
20+ internal class PsesDocumentHighlightHandler : DocumentHighlightHandlerBase
2121 {
2222 private static readonly DocumentHighlightContainer s_emptyHighlightContainer = new DocumentHighlightContainer ( ) ;
23-
2423 private readonly ILogger _logger ;
25-
2624 private readonly WorkspaceService _workspaceService ;
27-
2825 private readonly SymbolsService _symbolsService ;
2926
30- private DocumentHighlightCapability _capability ;
31-
3227 public PsesDocumentHighlightHandler (
3328 ILoggerFactory loggerFactory ,
3429 WorkspaceService workspaceService ,
@@ -40,15 +35,12 @@ public PsesDocumentHighlightHandler(
4035 _logger . LogInformation ( "highlight handler loaded" ) ;
4136 }
4237
43- public DocumentHighlightRegistrationOptions GetRegistrationOptions ( )
38+ protected override DocumentHighlightRegistrationOptions CreateRegistrationOptions ( DocumentHighlightCapability capability , ClientCapabilities clientCapabilities ) => new DocumentHighlightRegistrationOptions
4439 {
45- return new DocumentHighlightRegistrationOptions
46- {
47- DocumentSelector = LspUtils . PowerShellDocumentSelector
48- } ;
49- }
40+ DocumentSelector = LspUtils . PowerShellDocumentSelector
41+ } ;
5042
51- public Task < DocumentHighlightContainer > Handle (
43+ public override Task < DocumentHighlightContainer > Handle (
5244 DocumentHighlightParams request ,
5345 CancellationToken cancellationToken )
5446 {
@@ -76,10 +68,5 @@ public Task<DocumentHighlightContainer> Handle(
7668
7769 return Task . FromResult ( new DocumentHighlightContainer ( highlights ) ) ;
7870 }
79-
80- public void SetCapability ( DocumentHighlightCapability capability )
81- {
82- _capability = capability ;
83- }
8471 }
8572}
0 commit comments