1515using Microsoft . PowerShell . EditorServices . Services ;
1616using Microsoft . PowerShell . EditorServices . Services . TextDocument ;
1717using Microsoft . PowerShell . EditorServices . Utility ;
18- using OmniSharp . Extensions . LanguageServer . Protocol ;
1918using OmniSharp . Extensions . LanguageServer . Protocol . Client . Capabilities ;
2019using OmniSharp . Extensions . LanguageServer . Protocol . Document ;
2120using OmniSharp . Extensions . LanguageServer . Protocol . Models ;
2221
2322namespace Microsoft . PowerShell . EditorServices . Handlers
2423{
24+ // TODO: Use ABCs.
2525 internal class PsesCodeLensHandlers : ICodeLensHandler , ICodeLensResolveHandler
2626 {
27- private readonly Guid _id = new Guid ( ) ;
2827 private readonly ILogger _logger ;
2928 private readonly SymbolsService _symbolsService ;
3029 private readonly WorkspaceService _workspaceService ;
31-
3230 private CodeLensCapability _capability ;
33- public Guid Id => _id ;
31+ private readonly Guid _id = Guid . NewGuid ( ) ;
32+ Guid ICanBeIdentifiedHandler . Id => _id ;
3433
3534 public PsesCodeLensHandlers ( ILoggerFactory factory , SymbolsService symbolsService , WorkspaceService workspaceService , ConfigurationService configurationService )
3635 {
@@ -39,13 +38,15 @@ public PsesCodeLensHandlers(ILoggerFactory factory, SymbolsService symbolsServic
3938 _symbolsService = symbolsService ;
4039 }
4140
42- CodeLensRegistrationOptions IRegistration < CodeLensRegistrationOptions > . GetRegistrationOptions ( )
41+ public CodeLensRegistrationOptions GetRegistrationOptions ( CodeLensCapability capability , ClientCapabilities clientCapabilities ) => new CodeLensRegistrationOptions
4342 {
44- return new CodeLensRegistrationOptions
45- {
46- DocumentSelector = LspUtils . PowerShellDocumentSelector ,
47- ResolveProvider = true
48- } ;
43+ DocumentSelector = LspUtils . PowerShellDocumentSelector ,
44+ ResolveProvider = true
45+ } ;
46+
47+ public void SetCapability ( CodeLensCapability capability , ClientCapabilities clientCapabilities )
48+ {
49+ _capability = capability ;
4950 }
5051
5152 public Task < CodeLensContainer > Handle ( CodeLensParams request , CancellationToken cancellationToken )
@@ -57,14 +58,6 @@ public Task<CodeLensContainer> Handle(CodeLensParams request, CancellationToken
5758 return Task . FromResult ( new CodeLensContainer ( codeLensResults ) ) ;
5859 }
5960
60- public TextDocumentRegistrationOptions GetRegistrationOptions ( )
61- {
62- return new TextDocumentRegistrationOptions
63- {
64- DocumentSelector = LspUtils . PowerShellDocumentSelector ,
65- } ;
66- }
67-
6861 public bool CanResolve ( CodeLens value )
6962 {
7063 CodeLensData codeLensData = value . Data . ToObject < CodeLensData > ( ) ;
0 commit comments