15
15
using Microsoft . PowerShell . EditorServices . Services ;
16
16
using Microsoft . PowerShell . EditorServices . Services . TextDocument ;
17
17
using Microsoft . PowerShell . EditorServices . Utility ;
18
- using OmniSharp . Extensions . LanguageServer . Protocol ;
19
18
using OmniSharp . Extensions . LanguageServer . Protocol . Client . Capabilities ;
20
19
using OmniSharp . Extensions . LanguageServer . Protocol . Document ;
21
20
using OmniSharp . Extensions . LanguageServer . Protocol . Models ;
22
21
23
22
namespace Microsoft . PowerShell . EditorServices . Handlers
24
23
{
24
+ // TODO: Use ABCs.
25
25
internal class PsesCodeLensHandlers : ICodeLensHandler , ICodeLensResolveHandler
26
26
{
27
- private readonly Guid _id = new Guid ( ) ;
28
27
private readonly ILogger _logger ;
29
28
private readonly SymbolsService _symbolsService ;
30
29
private readonly WorkspaceService _workspaceService ;
31
-
32
30
private CodeLensCapability _capability ;
33
- public Guid Id => _id ;
31
+ private readonly Guid _id = Guid . NewGuid ( ) ;
32
+ Guid ICanBeIdentifiedHandler . Id => _id ;
34
33
35
34
public PsesCodeLensHandlers ( ILoggerFactory factory , SymbolsService symbolsService , WorkspaceService workspaceService , ConfigurationService configurationService )
36
35
{
@@ -39,13 +38,15 @@ public PsesCodeLensHandlers(ILoggerFactory factory, SymbolsService symbolsServic
39
38
_symbolsService = symbolsService ;
40
39
}
41
40
42
- CodeLensRegistrationOptions IRegistration < CodeLensRegistrationOptions > . GetRegistrationOptions ( )
41
+ public CodeLensRegistrationOptions GetRegistrationOptions ( CodeLensCapability capability , ClientCapabilities clientCapabilities ) => new CodeLensRegistrationOptions
43
42
{
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 ;
49
50
}
50
51
51
52
public Task < CodeLensContainer > Handle ( CodeLensParams request , CancellationToken cancellationToken )
@@ -57,14 +58,6 @@ public Task<CodeLensContainer> Handle(CodeLensParams request, CancellationToken
57
58
return Task . FromResult ( new CodeLensContainer ( codeLensResults ) ) ;
58
59
}
59
60
60
- public TextDocumentRegistrationOptions GetRegistrationOptions ( )
61
- {
62
- return new TextDocumentRegistrationOptions
63
- {
64
- DocumentSelector = LspUtils . PowerShellDocumentSelector ,
65
- } ;
66
- }
67
-
68
61
public bool CanResolve ( CodeLens value )
69
62
{
70
63
CodeLensData codeLensData = value . Data . ToObject < CodeLensData > ( ) ;
0 commit comments