Dont show fields in global completions and from usingnamespaced scopes
This commit is contained in:
parent
0592513da4
commit
7f12928fe9
@ -1209,6 +1209,7 @@ pub fn iterateSymbolsContainer(
|
|||||||
orig_handle: *DocumentStore.Handle,
|
orig_handle: *DocumentStore.Handle,
|
||||||
comptime callback: var,
|
comptime callback: var,
|
||||||
context: var,
|
context: var,
|
||||||
|
include_fields: bool,
|
||||||
) error{OutOfMemory}!void {
|
) error{OutOfMemory}!void {
|
||||||
const container = container_handle.node;
|
const container = container_handle.node;
|
||||||
const handle = container_handle.handle;
|
const handle = container_handle.handle;
|
||||||
@ -1216,6 +1217,7 @@ pub fn iterateSymbolsContainer(
|
|||||||
if (findContainerScope(container_handle)) |container_scope| {
|
if (findContainerScope(container_handle)) |container_scope| {
|
||||||
var decl_it = container_scope.decls.iterator();
|
var decl_it = container_scope.decls.iterator();
|
||||||
while (decl_it.next()) |entry| {
|
while (decl_it.next()) |entry| {
|
||||||
|
if (!include_fields and entry.value == .ast_node and entry.value.ast_node.id == .ContainerField) continue;
|
||||||
const decl = DeclWithHandle{ .decl = &entry.value, .handle = handle };
|
const decl = DeclWithHandle{ .decl = &entry.value, .handle = handle };
|
||||||
if (handle != orig_handle and !decl.isPublic()) continue;
|
if (handle != orig_handle and !decl.isPublic()) continue;
|
||||||
try callback(context, decl);
|
try callback(context, decl);
|
||||||
@ -1224,7 +1226,7 @@ pub fn iterateSymbolsContainer(
|
|||||||
for (container_scope.uses) |use| {
|
for (container_scope.uses) |use| {
|
||||||
if (handle != orig_handle and use.visib_token == null) continue;
|
if (handle != orig_handle and use.visib_token == null) continue;
|
||||||
const use_expr = (try resolveTypeOfNode(store, arena, .{ .node = use.expr, .handle = handle })) orelse continue;
|
const use_expr = (try resolveTypeOfNode(store, arena, .{ .node = use.expr, .handle = handle })) orelse continue;
|
||||||
try iterateSymbolsContainer(store, arena, use_expr, orig_handle, callback, context);
|
try iterateSymbolsContainer(store, arena, use_expr, orig_handle, callback, context, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,12 +1245,13 @@ pub fn iterateSymbolsGlobal(
|
|||||||
if (source_index >= scope.range.start and source_index < scope.range.end) {
|
if (source_index >= scope.range.start and source_index < scope.range.end) {
|
||||||
var decl_it = scope.decls.iterator();
|
var decl_it = scope.decls.iterator();
|
||||||
while (decl_it.next()) |entry| {
|
while (decl_it.next()) |entry| {
|
||||||
|
if (entry.value == .ast_node and entry.value.ast_node.id == .ContainerField) continue;
|
||||||
try callback(context, DeclWithHandle{ .decl = &entry.value, .handle = handle });
|
try callback(context, DeclWithHandle{ .decl = &entry.value, .handle = handle });
|
||||||
}
|
}
|
||||||
|
|
||||||
for (scope.uses) |use| {
|
for (scope.uses) |use| {
|
||||||
const use_expr = (try resolveTypeOfNode(store, arena, .{ .node = use.expr, .handle = handle })) orelse continue;
|
const use_expr = (try resolveTypeOfNode(store, arena, .{ .node = use.expr, .handle = handle })) orelse continue;
|
||||||
try iterateSymbolsContainer(store, arena, use_expr, handle, callback, context);
|
try iterateSymbolsContainer(store, arena, use_expr, handle, callback, context, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ fn nodeToCompletion(
|
|||||||
.arena = arena,
|
.arena = arena,
|
||||||
.orig_handle = orig_handle,
|
.orig_handle = orig_handle,
|
||||||
};
|
};
|
||||||
try analysis.iterateSymbolsContainer(&document_store, arena, node_handle, orig_handle, declToCompletion, context);
|
try analysis.iterateSymbolsContainer(&document_store, arena, node_handle, orig_handle, declToCompletion, context, true);
|
||||||
},
|
},
|
||||||
.FnProto => {
|
.FnProto => {
|
||||||
const func = node.cast(std.zig.ast.Node.FnProto).?;
|
const func = node.cast(std.zig.ast.Node.FnProto).?;
|
||||||
|
Loading…
Reference in New Issue
Block a user