Skip to content

Commit c31b01f

Browse files
Kapil Borledaviwil
Kapil Borle
authored andcommitted
Update DidCloseTextDocumentNotification
1 parent 6d9218e commit c31b01f

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/PowerShellEditorServices.Protocol/LanguageServer/TextDocument.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public class TextDocumentPosition : TextDocumentIdentifier
8080
/// <summary>
8181
/// A parameter literal used in requests to pass a text document and a position inside that document.
8282
/// </summary>
83-
public class TextDocumentPositionParams {
83+
public class TextDocumentPositionParams
84+
{
8485
/// <summary>
8586
/// The text document.
8687
/// </summary>
@@ -115,8 +116,19 @@ public class DidOpenTextDocumentParams
115116
public class DidCloseTextDocumentNotification
116117
{
117118
public static readonly
118-
EventType<TextDocumentIdentifier> Type =
119-
EventType<TextDocumentIdentifier>.Create("textDocument/didClose");
119+
EventType<DidCloseTextDocumentParams> Type =
120+
EventType<DidCloseTextDocumentParams>.Create("textDocument/didClose");
121+
}
122+
123+
/// <summary>
124+
/// The parameters sent in a close text document notification.
125+
/// </summary>
126+
public class DidCloseTextDocumentParams
127+
{
128+
/// <summary>
129+
/// The document that was closed.
130+
/// </summary>
131+
public TextDocumentIdentifier TextDocument { get; set; }
120132
}
121133

122134
public class DidSaveTextDocumentNotification

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,11 @@ protected Task HandleDidOpenTextDocumentNotification(
503503
}
504504

505505
protected async Task HandleDidCloseTextDocumentNotification(
506-
TextDocumentIdentifier closeParams,
506+
DidCloseTextDocumentParams closeParams,
507507
EventContext eventContext)
508508
{
509509
// Find and close the file in the current session
510-
var fileToClose = editorSession.Workspace.GetFile(closeParams.Uri);
510+
var fileToClose = editorSession.Workspace.GetFile(closeParams.TextDocument.Uri);
511511

512512
if (fileToClose != null)
513513
{

0 commit comments

Comments
 (0)