Fixed enum completion bug

This commit is contained in:
Alexandros Naskos 2020-07-08 04:11:52 +03:00
parent 62774d065b
commit e1bce76c63

View File

@ -2044,18 +2044,20 @@ fn makeScopeInternal(
if (node.cast(ast.Node.ContainerDecl)) |container| { if (node.cast(ast.Node.ContainerDecl)) |container| {
const kind = tree.token_ids[container.kind_token]; const kind = tree.token_ids[container.kind_token];
if (empty_field and (kind == .Keyword_struct or (kind == .Keyword_union and container.init_arg_expr == .None))) { if (kind == .Keyword_struct or (kind == .Keyword_union and container.init_arg_expr == .None)) {
continue; continue;
} }
(try enum_completions.addOne(allocator)).* = .{ if (!std.mem.eql(u8, name, "_")) {
.label = name, (try enum_completions.addOne(allocator)).* = .{
.kind = .Constant, .label = name,
.documentation = if (try getDocComments(allocator, tree, decl, .Markdown)) |docs| .kind = .Constant,
.{ .kind = .Markdown, .value = docs } .documentation = if (try getDocComments(allocator, tree, decl, .Markdown)) |docs|
else .{ .kind = .Markdown, .value = docs }
null, else
}; null,
};
}
} }
} }