diff --git a/src/features/code_actions.zig b/src/features/code_actions.zig index e0252724f..888695fa7 100644 --- a/src/features/code_actions.zig +++ b/src/features/code_actions.zig @@ -149,7 +149,7 @@ pub fn generateStringLiteralCodeActions( }; // Check for disallowed characters and utf-8 validity for (parsed) |c| { - if (c == '\n' or c == '\r') continue; + if (c == '\n') continue; if (std.ascii.isControl(c)) return; } if (!std.unicode.utf8ValidateSlice(parsed)) return; diff --git a/tests/lsp_features/code_actions.zig b/tests/lsp_features/code_actions.zig index c78c3a7c2..c4587101f 100644 --- a/tests/lsp_features/code_actions.zig +++ b/tests/lsp_features/code_actions.zig @@ -807,6 +807,12 @@ test "convert string literal to multiline - invalid" { , \\const foo = "\tWe use tabs"; ); + // A Multi-Line String Literals can't contain carriage returns + try testConvertString( + \\const foo = "\r"; + , + \\const foo = "\r"; + ); // Not in @import try testConvertString( \\const std = @import("std");