Skip to content

Commit 5b65e59

Browse files
committed
Add body argument to AddNodeToDocumentAsync
1 parent 4b48088 commit 5b65e59

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

YarnSpinner.LanguageServer/src/Server/YarnLanguageServer.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,21 @@ private static Task<TextDocumentEdit> AddNodeToDocumentAsync(Workspace workspace
244244
}
245245
}
246246

247+
string body = "";
248+
if (commandParams.Arguments.Count >= 3)
249+
{
250+
if (commandParams.Arguments[2].Type == JTokenType.String)
251+
{
252+
body = (string)commandParams.Arguments[2];
253+
}
254+
else
255+
{
256+
workspace.ShowMessage("AddNodeToDocumentAsync: Argument 2 is expected to be a String", MessageType.Error);
257+
258+
return Task.FromResult<TextDocumentEdit>(new());
259+
}
260+
}
261+
247262
Uri yarnDocumentUri = new(yarnDocumentUriString);
248263

249264
var project = workspace.GetProjectsForUri(yarnDocumentUri).FirstOrDefault();
@@ -290,7 +305,7 @@ private static Task<TextDocumentEdit> AddNodeToDocumentAsync(Workspace workspace
290305

291306
newNodeText
292307
.AppendLine("---")
293-
.AppendLine()
308+
.AppendLine(body)
294309
.AppendLine("===");
295310

296311
Position position;

0 commit comments

Comments
 (0)