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
This commit is contained in:
Travis Staloch 2022-12-17 14:27:51 -08:00
parent 5d6f23b5f1
commit e09c773005
No known key found for this signature in database
GPG Key ID: 9726F5C64475E635

View File

@ -1612,6 +1612,7 @@ pub fn getPositionContext(allocator: std.mem.Allocator, text: []const u8, doc_in
.field_access => {}, .field_access => {},
.other => {}, .other => {},
.global_error_set => {}, .global_error_set => {},
.label => {},
else => curr_ctx.ctx = .{ else => curr_ctx.ctx = .{
.field_access = tokenLocAppend(curr_ctx.ctx.loc().?, tok), .field_access = tokenLocAppend(curr_ctx.ctx.loc().?, tok),
}, },