Skip to content

Commit 6721894

Browse files
authored
fix: also escape \ when pretty printing anonymous nodes (#14819)
1 parent 80530d8 commit 6721894

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

helix-core/src/syntax.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,8 +1090,8 @@ fn node_is_visible(node: &Node) -> bool {
10901090
}
10911091

10921092
fn format_anonymous_node_kind(kind: &str) -> Cow<'_, str> {
1093-
if kind.contains('"') {
1094-
Cow::Owned(kind.replace('"', "\\\""))
1093+
if kind.contains('"') || kind.contains('\\') {
1094+
Cow::Owned(kind.replace('\\', "\\\\").replace('"', "\\\""))
10951095
} else {
10961096
Cow::Borrowed(kind)
10971097
}

0 commit comments

Comments
 (0)