File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -312,6 +312,9 @@ SourceEdit _removeFromBlockList(
312312 final yaml = yamlEdit.toString ();
313313 final span = nodeToRemove.span;
314314
315+ final isEmptySpan = span.length == 0 ; // Just the '-'
316+ final end = getContentSensitiveEnd (nodeToRemove);
317+
315318 return removeBlockCollectionEntry (
316319 yaml,
317320 blockCollection: list,
@@ -320,10 +323,11 @@ SourceEdit _removeFromBlockList(
320323 isSingleEntry: listSize == 1 ,
321324 isLastEntry: index >= listSize - 1 ,
322325 nodeToRemoveOffset: (
323- start: span.length == 0
324- ? span.start.offset
325- : yaml.lastIndexOf ('-' , span.start.offset - 1 ),
326- end: getContentSensitiveEnd (nodeToRemove)
326+ start: yaml.lastIndexOf (
327+ '-' ,
328+ isEmptySpan ? span.start.offset : span.start.offset - 1 ,
329+ ),
330+ end: isEmptySpan ? end + 1 : end,
327331 ),
328332 lineEnding: getLineEnding (yaml),
329333 nextBlockNodeInfo: () {
You can’t perform that action at this time.
0 commit comments