File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
src/PowerShellEditorServices.Protocol Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ //
2+ // Copyright (c) Microsoft. All rights reserved.
3+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+ //
5+
6+ using Microsoft . PowerShell . EditorServices . Protocol . MessageProtocol ;
7+
8+ namespace Microsoft . PowerShell . EditorServices . Protocol . LanguageServer
9+ {
10+ /// <summary>
11+ /// The initialized notification is sent from the client to the server after the client received the result
12+ /// of the initialize request but before the client is sending any other request or notification to the server.
13+ /// The server can use the initialized notification for example to dynamically register capabilities.
14+ /// The initialized notification may only be sent once.
15+ /// </summary>
16+ public class InitializedNotification
17+ {
18+ public static readonly
19+ NotificationType < InitializedParams , object > Type =
20+ NotificationType < InitializedParams , object > . Create ( "initialized" ) ;
21+ }
22+
23+ /// <summary>
24+ /// Currently, the initialized message has no parameters.
25+ /// </summary>
26+ public class InitializedParams
27+ {
28+ }
29+ }
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ public void Start()
9999 this . messageHandlers . SetEventHandler ( ExitNotification . Type , this . HandleExitNotification ) ;
100100
101101 this . messageHandlers . SetRequestHandler ( InitializeRequest . Type , this . HandleInitializeRequest ) ;
102+ this . messageHandlers . SetEventHandler ( InitializedNotification . Type , this . HandleInitializedNotification ) ;
102103
103104 this . messageHandlers . SetEventHandler ( DidOpenTextDocumentNotification . Type , this . HandleDidOpenTextDocumentNotification ) ;
104105 this . messageHandlers . SetEventHandler ( DidCloseTextDocumentNotification . Type , this . HandleDidCloseTextDocumentNotification ) ;
@@ -178,6 +179,13 @@ private async Task HandleExitNotification(
178179 await this . Stop ( ) ;
179180 }
180181
182+ private Task HandleInitializedNotification ( InitializedParams initializedParams ,
183+ EventContext eventContext )
184+ {
185+ // Can do dynamic registration of capabilities in this notification handler
186+ return Task . FromResult ( true ) ;
187+ }
188+
181189 protected async Task HandleInitializeRequest (
182190 InitializeParams initializeParams ,
183191 RequestContext < InitializeResult > requestContext )
You can’t perform that action at this time.
0 commit comments