Fixed sort dropping head comment #1181

This commit is contained in:
Mike Farah
2022-04-14 12:19:15 +10:00
parent 6f9f80cc48
commit ea66a73f43
4 changed files with 20 additions and 8 deletions
+1
View File
@@ -105,6 +105,7 @@ func getCommentsOperator(d *dataTreeNavigator, context Context, expressionNode *
node := &yaml.Node{Kind: yaml.ScalarNode, Value: comment, Tag: "!!str"}
result := candidate.CreateReplacement(node)
result.LeadingContent = "" // don't include the leading yaml content when retrieving a comment
results.PushBack(result)
}
return context.ChildContext(results), nil