Skip to content

Commit

Permalink
updated BuildEndNode to accomodate quotes
Browse files Browse the repository at this point in the history
Signed-off-by: quobix <dave@quobix.com>
  • Loading branch information
daveshanley committed Apr 3, 2024
1 parent d3cd35a commit 3a990a7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion utils/end_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ func BuildEndNode(node *yaml.Node) *yaml.Node {
if node == nil {
return nil
}
return &yaml.Node{Line: node.Line, Column: node.Column + len(node.Value), Kind: node.Kind, Value: node.Value}
modifier := 0
// quotes need to be accounted for
if node.Style == yaml.DoubleQuotedStyle || node.Style == yaml.SingleQuotedStyle {
modifier = 2
}
return &yaml.Node{Line: node.Line, Column: node.Column + len(node.Value) + modifier, Kind: node.Kind, Value: node.Value}
}

0 comments on commit 3a990a7

Please sign in to comment.