Skip to content

Commit dd1e4f2

Browse files
committed
Update language server protocol
This change updates the language server protocol to respond to some last minute changes in VS Code's JSON RPC messages.
1 parent 6520966 commit dd1e4f2

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

src/PowerShellEditorServices.Host/LanguageServer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,16 @@ protected Task HandleDidCloseTextDocumentNotification(
177177
}
178178

179179
protected Task HandleDidChangeTextDocumentNotification(
180-
DidChangeTextDocumentNotification[] textChangeParams,
180+
DidChangeTextDocumentParams textChangeParams,
181181
EditorSession editorSession,
182182
EventContext eventContext)
183183
{
184184
List<ScriptFile> changedFiles = new List<ScriptFile>();
185185

186186
// A text change notification can batch multiple change requests
187-
foreach (var textChange in textChangeParams)
187+
foreach (var textChange in textChangeParams.ContentChanges)
188188
{
189-
ScriptFile changedFile = editorSession.Workspace.GetFile(textChange.Uri);
189+
ScriptFile changedFile = editorSession.Workspace.GetFile(textChangeParams.Uri);
190190

191191
changedFile.ApplyChange(
192192
GetFileChangeDetails(

src/PowerShellEditorServices.Protocol/LanguageServer/CompletionMessages.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ public class CompletionItem
7575
public string InsertText { get; set; }
7676

7777
public TextEdit TextEdit { get; set; }
78+
79+
/// <summary>
80+
/// Gets or sets a custom data field that allows the server to mark
81+
/// each completion item with an identifier that will help correlate
82+
/// the item to the previous completion request during a completion
83+
/// resolve request.
84+
/// </summary>
85+
public object Data { get; set; }
7886
}
7987
}
8088

src/PowerShellEditorServices.Protocol/LanguageServer/References.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public static readonly
1616

1717
public class ReferencesParams : TextDocumentPosition
1818
{
19-
public ReferencesOptions Options { get; set; }
19+
public ReferencesContext Context { get; set; }
2020
}
2121

22-
public class ReferencesOptions
22+
public class ReferencesContext
2323
{
2424
public bool IncludeDeclaration { get; set; }
2525
}

src/PowerShellEditorServices.Protocol/LanguageServer/TextDocumentMessages.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,23 @@ public static readonly
4949
EventType<TextDocumentIdentifier>.Create("textDocument/didClose");
5050
}
5151

52-
public class DidChangeTextDocumentNotification : TextDocumentIdentifier
52+
public class DidChangeTextDocumentNotification
5353
{
5454
public static readonly
55-
EventType<DidChangeTextDocumentNotification[]> Type =
56-
EventType<DidChangeTextDocumentNotification[]>.Create("textDocument/didChange");
55+
EventType<DidChangeTextDocumentParams> Type =
56+
EventType<DidChangeTextDocumentParams>.Create("textDocument/didChange");
57+
}
5758

59+
public class DidChangeTextDocumentParams : TextDocumentIdentifier
60+
{
61+
/// <summary>
62+
/// Gets or sets the list of changes to the document content.
63+
/// </summary>
64+
public TextDocumentChangeEvent[] ContentChanges { get; set; }
65+
}
66+
67+
public class TextDocumentChangeEvent
68+
{
5869
/// <summary>
5970
/// Gets or sets the Range where the document was changed. Will
6071
/// be null if the server's TextDocumentSyncKind is Full.

0 commit comments

Comments
 (0)