Skip to content

Commit

Permalink
escape identifiers when renaming (#2127)
Browse files Browse the repository at this point in the history
  • Loading branch information
xdBronch authored Dec 31, 2024
1 parent b8a11d5 commit 8d8eb29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/features/references.zig
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,14 @@ pub fn referencesHandler(server: *Server, arena: std.mem.Allocator, request: Gen

switch (request) {
.rename => |rename| {
const escaped_rename = try std.fmt.allocPrint(arena, "{}", .{std.zig.fmtId(rename.newName)});
var changes = std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(types.TextEdit)){};

for (locations.items) |loc| {
const gop = try changes.getOrPutValue(arena, loc.uri, .{});
try gop.value_ptr.append(arena, .{
.range = loc.range,
.newText = rename.newName,
.newText = escaped_rename,
});
}

Expand Down

0 comments on commit 8d8eb29

Please sign in to comment.