Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 48d2ceb

Browse files
TODO: Use ABCs in these classes.
1 parent f5497c1 commit 48d2ceb

File tree

3 files changed

+22
-29
lines changed

3 files changed

+22
-29
lines changed

‎src/PowerShellEditorServices/Services/TextDocument/Handlers/CodeLensHandlers.cs‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
using Microsoft.PowerShell.EditorServices.Services;
1616
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
1717
using Microsoft.PowerShell.EditorServices.Utility;
18-
using OmniSharp.Extensions.LanguageServer.Protocol;
1918
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
2019
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
2120
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
2221

2322
namespace Microsoft.PowerShell.EditorServices.Handlers
2423
{
24+
// TODO: Use ABCs.
2525
internal class PsesCodeLensHandlers : ICodeLensHandler, ICodeLensResolveHandler
2626
{
2727
private readonly Guid _id = new Guid();
@@ -39,13 +39,15 @@ public PsesCodeLensHandlers(ILoggerFactory factory, SymbolsService symbolsServic
3939
_symbolsService = symbolsService;
4040
}
4141

42-
CodeLensRegistrationOptionsIRegistration<CodeLensRegistrationOptions>.GetRegistrationOptions()
42+
publicCodeLensRegistrationOptionsGetRegistrationOptions(CodeLensCapabilitycapability,ClientCapabilitiesclientCapabilities)=>newCodeLensRegistrationOptions
4343
{
44-
return new CodeLensRegistrationOptions
45-
{
46-
DocumentSelector = LspUtils.PowerShellDocumentSelector,
47-
ResolveProvider = true
48-
};
44+
DocumentSelector = LspUtils.PowerShellDocumentSelector,
45+
ResolveProvider = true
46+
};
47+
48+
public void SetCapability(CodeLensCapability capability, ClientCapabilities clientCapabilities)
49+
{
50+
_capability = capability;
4951
}
5052

5153
public Task<CodeLensContainer> Handle(CodeLensParams request, CancellationToken cancellationToken)
@@ -57,14 +59,6 @@ public Task<CodeLensContainer> Handle(CodeLensParams request, CancellationToken
5759
return Task.FromResult(new CodeLensContainer(codeLensResults));
5860
}
5961

60-
public TextDocumentRegistrationOptions GetRegistrationOptions()
61-
{
62-
return new TextDocumentRegistrationOptions
63-
{
64-
DocumentSelector = LspUtils.PowerShellDocumentSelector,
65-
};
66-
}
67-
6862
public bool CanResolve(CodeLens value)
6963
{
7064
CodeLensData codeLensData = value.Data.ToObject<CodeLensData>();

‎src/PowerShellEditorServices/Services/TextDocument/Handlers/CompletionHandler.cs‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
namespace Microsoft.PowerShell.EditorServices.Handlers
2323
{
24+
// TODO: Use ABCs.
2425
internal class PsesCompletionHandler : ICompletionHandler, ICompletionResolveHandler
2526
{
2627
const int DefaultWaitTimeoutMilliseconds = 5000;
@@ -51,17 +52,14 @@ public PsesCompletionHandler(
5152
_workspaceService = workspaceService;
5253
}
5354

54-
publicCompletionRegistrationOptions GetRegistrationOptions()
55+
protectedoverrideCompletionRegistrationOptions CreateRegistrationOptions(CompletionCapabilitycapability,ClientCapabilitiesclientCapabilities)=>newCompletionRegistrationOptions
5556
{
56-
return new CompletionRegistrationOptions
57-
{
58-
DocumentSelector = LspUtils.PowerShellDocumentSelector,
59-
ResolveProvider = true,
60-
TriggerCharacters = new[] { ".", "-", ":", "\\" }
61-
};
62-
}
57+
DocumentSelector = LspUtils.PowerShellDocumentSelector,
58+
ResolveProvider = true,
59+
TriggerCharacters = new[] { ".", "-", ":", "\\" }
60+
};
6361

64-
public async Task<CompletionList> Handle(CompletionParams request, CancellationToken cancellationToken)
62+
public overrideasync Task<CompletionList> Handle(CompletionParams request, CancellationToken cancellationToken)
6563
{
6664
int cursorLine = request.Position.Line + 1;
6765
int cursorColumn = request.Position.Character + 1;
@@ -117,7 +115,7 @@ public bool CanResolve(CompletionItem value)
117115
}
118116

119117
// Handler for "completionItem/resolve". In VSCode this is fired when a completion item is highlighted in the completion list.
120-
public async Task<CompletionItem> Handle(CompletionItem request, CancellationToken cancellationToken)
118+
public async overrideTask<CompletionItem> Handle(CompletionItem request, CancellationToken cancellationToken)
121119
{
122120
// We currently only support this request for anything that returns a CommandInfo: functions, cmdlets, aliases.
123121
if (request.Kind != CompletionItemKind.Function)
@@ -145,10 +143,10 @@ await CommandHelpers.GetCommandInfoAsync(
145143

146144
if (commandInfo != null)
147145
{
148-
request.Documentation=
149-
awaitCommandHelpers.GetCommandSynopsisAsync(
150-
commandInfo,
151-
_powerShellContextService).ConfigureAwait(false);
146+
request=requestwith
147+
{
148+
Documentation=awaitCommandHelpers.GetCommandSynopsisAsync(commandInfo,_powerShellContextService).ConfigureAwait(false)
149+
};
152150
}
153151

154152
// Send back the updated CompletionItem

‎src/PowerShellEditorServices/Services/TextDocument/Handlers/FormattingHandlers.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
namespace Microsoft.PowerShell.EditorServices.Handlers
1818
{
1919
// TODO: Add IDocumentOnTypeFormatHandler to support on-type formatting.
20+
// TODO: Use ABCs.
2021
internal class PsesDocumentFormattingHandlers : IDocumentFormattingHandler, IDocumentRangeFormattingHandler
2122
{
2223
private readonly ILogger _logger;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /