3
3
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4
4
//
5
5
6
+ using System ;
7
+ using System . Management . Automation . Language ;
6
8
using System . Threading ;
7
9
using System . Threading . Tasks ;
8
10
using Microsoft . Extensions . Logging ;
9
11
using Microsoft . PowerShell . EditorServices . Services ;
10
12
using Microsoft . PowerShell . EditorServices . Services . TextDocument ;
11
- using System . Management . Automation . Language ;
13
+ using Microsoft . PowerShell . EditorServices . Utility ;
12
14
using OmniSharp . Extensions . LanguageServer . Protocol ;
13
15
using OmniSharp . Extensions . LanguageServer . Protocol . Document . Proposals ;
14
16
using OmniSharp . Extensions . LanguageServer . Protocol . Models ;
15
17
using OmniSharp . Extensions . LanguageServer . Protocol . Models . Proposals ;
16
- using System ;
17
- using Microsoft . PowerShell . EditorServices . Utility ;
18
18
19
19
namespace Microsoft . PowerShell . EditorServices . Handlers
20
20
{
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.
22
22
#pragma warning disable 618
23
23
internal class PsesSemanticTokens : SemanticTokensHandler
24
24
{
@@ -27,8 +27,8 @@ internal class PsesSemanticTokens : SemanticTokensHandler
27
27
static readonly SemanticTokensRegistrationOptions _registrationOptions = new SemanticTokensRegistrationOptions ( ) {
28
28
DocumentSelector = LspUtils . PowerShellDocumentSelector ,
29
29
Legend = new SemanticTokensLegend ( ) ,
30
- DocumentProvider = new Supports < SemanticTokensDocumentProviderOptions > ( true ,
31
- new SemanticTokensDocumentProviderOptions ( ) {
30
+ DocumentProvider = new Supports < SemanticTokensDocumentProviderOptions > ( isSupported : true ,
31
+ new SemanticTokensDocumentProviderOptions {
32
32
Edits = true
33
33
} ) ,
34
34
RangeProvider = true
@@ -70,7 +70,8 @@ private static void PushToken(Token token, SemanticTokensBuilder builder)
70
70
int line = token . Extent . StartLineNumber - 1 ;
71
71
int index = token . Extent . StartColumnNumber - 1 ;
72
72
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 > ( ) ) ;
74
75
}
75
76
76
77
private static SemanticTokenType MapSemanticToken ( Token token )
0 commit comments