set Enum completion kind to .EnumMember
This commit is contained in:
parent
1020817ed0
commit
c446087231
@ -51,7 +51,7 @@ pub fn dotCompletions(
|
||||
while (field_it.next()) |entry| {
|
||||
try completions.append(arena, .{
|
||||
.label = entry.key_ptr.*,
|
||||
.kind = .Constant,
|
||||
.kind = .EnumMember,
|
||||
// include field.val?
|
||||
});
|
||||
}
|
||||
|
@ -2701,7 +2701,7 @@ fn makeInnerScope(context: ScopeContext, tree: Ast, node_idx: Ast.Node.Index) er
|
||||
errdefer if (doc) |d| allocator.free(d);
|
||||
var gop_res = try context.doc_scope.enum_completions.getOrPut(allocator, .{
|
||||
.label = name,
|
||||
.kind = .Enum,
|
||||
.kind = .EnumMember,
|
||||
.insertText = name,
|
||||
.insertTextFormat = .PlainText,
|
||||
.documentation = if (doc) |d| .{ .MarkupContent = types.MarkupContent{ .kind = .markdown, .value = d } } else null,
|
||||
|
@ -223,7 +223,7 @@ fn nodeToCompletion(
|
||||
const field = tree.fullContainerField(node).?;
|
||||
try list.append(allocator, .{
|
||||
.label = handle.tree.tokenSlice(field.ast.main_token),
|
||||
.kind = if (field.ast.tuple_like) .Enum else .Field,
|
||||
.kind = if (field.ast.tuple_like) .EnumMember else .Field,
|
||||
.documentation = doc,
|
||||
.detail = Analyser.getContainerFieldSignature(handle.tree, field),
|
||||
.insertText = tree.tokenSlice(field.ast.main_token),
|
||||
@ -729,6 +729,7 @@ fn kindToSortScore(kind: types.CompletionItemKind) ?[]const u8 {
|
||||
.Class,
|
||||
.Interface,
|
||||
.Struct,
|
||||
.Enum,
|
||||
// Union?
|
||||
.TypeParameter,
|
||||
=> "6_",
|
||||
@ -757,7 +758,7 @@ pub fn addStructInitNodeFields(server: *Server, decl: Analyser.DeclWithHandle, c
|
||||
const field = decl.handle.tree.fullContainerField(member) orelse continue;
|
||||
try completions.append(server.arena.allocator(), .{
|
||||
.label = decl.handle.tree.tokenSlice(field.ast.main_token),
|
||||
.kind = if (field.ast.tuple_like) .Enum else .Field,
|
||||
.kind = if (field.ast.tuple_like) .EnumMember else .Field,
|
||||
.detail = Analyser.getContainerFieldSignature(decl.handle.tree, field),
|
||||
.insertText = decl.handle.tree.tokenSlice(field.ast.main_token),
|
||||
.insertTextFormat = .PlainText,
|
||||
@ -770,7 +771,7 @@ pub fn addStructInitNodeFields(server: *Server, decl: Analyser.DeclWithHandle, c
|
||||
const field = decl.handle.tree.fullContainerField(@intCast(u32, root_node)) orelse continue;
|
||||
try completions.append(server.arena.allocator(), .{
|
||||
.label = decl.handle.tree.tokenSlice(field.ast.main_token),
|
||||
.kind = if (field.ast.tuple_like) .Enum else .Field,
|
||||
.kind = if (field.ast.tuple_like) .EnumMember else .Field,
|
||||
.detail = Analyser.getContainerFieldSignature(decl.handle.tree, field),
|
||||
.insertText = decl.handle.tree.tokenSlice(field.ast.main_token),
|
||||
.insertTextFormat = .PlainText,
|
||||
|
@ -297,8 +297,8 @@ test "completion - enum" {
|
||||
\\};
|
||||
\\const foo = E.<cursor>
|
||||
, &.{
|
||||
.{ .label = "alpha", .kind = .Enum },
|
||||
.{ .label = "beta", .kind = .Enum },
|
||||
.{ .label = "alpha", .kind = .EnumMember },
|
||||
.{ .label = "beta", .kind = .EnumMember },
|
||||
});
|
||||
try testCompletion(
|
||||
\\const E = enum {
|
||||
@ -307,8 +307,8 @@ test "completion - enum" {
|
||||
\\};
|
||||
\\const foo: E = .<cursor>
|
||||
, &.{
|
||||
.{ .label = "alpha", .kind = .Enum },
|
||||
.{ .label = "beta", .kind = .Enum },
|
||||
.{ .label = "alpha", .kind = .EnumMember },
|
||||
.{ .label = "beta", .kind = .EnumMember },
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user