From e09c773005802a790ef22b51ab2dabc607079508 Mon Sep 17 00:00:00 2001 From: Travis Staloch Date: Sat, 17 Dec 2022 14:27:51 -0800 Subject: [PATCH] analysis.zig getPositionContext() - check for null closes #754 and #832 this pr just adds `.label => {}` to the switch as suggested by @nullptrdevs, thereby preventing the null unwrap. i checked that zls no longer crashes when positioning the cursor on Server.zig:2287:41 which is this line: `break :blk .{ .WorkspaceEdit = edits };` ^ cursor here previously crashed zls --- src/analysis.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/analysis.zig b/src/analysis.zig index 09a6ad3..7eadf06 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -1612,6 +1612,7 @@ pub fn getPositionContext(allocator: std.mem.Allocator, text: []const u8, doc_in .field_access => {}, .other => {}, .global_error_set => {}, + .label => {}, else => curr_ctx.ctx = .{ .field_access = tokenLocAppend(curr_ctx.ctx.loc().?, tok), },