Skip to content

Commit 01bde39

Browse files
author
Justin Chen
committed
moved/refactored handler
1 parent a55108c commit 01bde39

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/PsesSemanticTokens.cs renamed to src/PowerShellEditorServices/Services/TextDocument/Handlers/PsesSemanticTokens.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6+
using System;
7+
using System.Management.Automation.Language;
68
using System.Threading;
79
using System.Threading.Tasks;
810
using Microsoft.Extensions.Logging;
911
using Microsoft.PowerShell.EditorServices.Services;
1012
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
11-
using System.Management.Automation.Language;
13+
using Microsoft.PowerShell.EditorServices.Utility;
1214
using OmniSharp.Extensions.LanguageServer.Protocol;
1315
using OmniSharp.Extensions.LanguageServer.Protocol.Document.Proposals;
1416
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
1517
using OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals;
16-
using System;
17-
using Microsoft.PowerShell.EditorServices.Utility;
1818

1919
namespace Microsoft.PowerShell.EditorServices.Handlers
2020
{
21-
//Disable warnings having to do with SemanticTokensHandler being labelled obsolete
21+
//SemanticTokensHandler is labeled "Obsolete" because that is how Omnisharp marks proposed LSP features. Since we want this proposed feature, we disable this warning.
2222
#pragma warning disable 618
2323
internal class PsesSemanticTokens : SemanticTokensHandler
2424
{
@@ -27,8 +27,8 @@ internal class PsesSemanticTokens : SemanticTokensHandler
2727
static readonly SemanticTokensRegistrationOptions _registrationOptions = new SemanticTokensRegistrationOptions() {
2828
DocumentSelector = LspUtils.PowerShellDocumentSelector,
2929
Legend = new SemanticTokensLegend(),
30-
DocumentProvider = new Supports<SemanticTokensDocumentProviderOptions>(true,
31-
new SemanticTokensDocumentProviderOptions() {
30+
DocumentProvider = new Supports<SemanticTokensDocumentProviderOptions>(isSupported: true,
31+
new SemanticTokensDocumentProviderOptions {
3232
Edits = true
3333
}),
3434
RangeProvider = true
@@ -70,7 +70,8 @@ private static void PushToken(Token token, SemanticTokensBuilder builder)
7070
int line = token.Extent.StartLineNumber - 1;
7171
int index = token.Extent.StartColumnNumber - 1;
7272

73-
builder.Push(line, index, token.Text.Length, MapSemanticToken(token), Array.Empty<string>());
73+
builder.Push(line: line, @char: index, length: token.Text.Length,
74+
tokenType: MapSemanticToken(token), tokenModifiers: Array.Empty<string>());
7475
}
7576

7677
private static SemanticTokenType MapSemanticToken(Token token)

0 commit comments

Comments
 (0)