Skip to content

Commit ff8cedd

Browse files
committed
Fix .import_string_literal completions
1 parent dcc0560 commit ff8cedd

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/features/completions.zig

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,6 @@ fn completeError(builder: *Builder, token_index: std.zig.Ast.TokenIndex) Analyse
926926
fn completeFileSystemStringLiteral(builder: *Builder, pos_context: Analyser.PositionContext) Analyser.Error!void {
927927
const io = builder.server.io;
928928

929-
var completions: CompletionSet = .empty;
930929
const store = &builder.server.document_store;
931930
const source = builder.orig_handle.tree.source;
932931

@@ -984,26 +983,26 @@ fn completeFileSystemStringLiteral(builder: *Builder, pos_context: Analyser.Posi
984983

985984
try builder.completions.ensureUnusedCapacity(builder.arena, build_config.deps_build_roots.len);
986985
for (build_config.deps_build_roots) |dbr| {
987-
completions.putAssumeCapacity(.{
986+
builder.completions.appendAssumeCapacity(.{
988987
.label = dbr.name,
989988
.kind = .Module,
990989
.detail = dbr.path,
991990
.sortText = try generateSortText(builder.arena, 4, dbr.name),
992-
}, {});
991+
});
993992
}
994993
} else if (try builder.orig_handle.getAssociatedBuildFileUri(store)) |uri| blk: {
995994
const build_file = store.getBuildFile(uri).?;
996995
const build_config = build_file.tryLockConfig(store.io) orelse break :blk;
997996
defer build_file.unlockConfig(store.io);
998997

999-
try completions.ensureUnusedCapacity(builder.arena, build_config.packages.len);
998+
try builder.completions.ensureUnusedCapacity(builder.arena, build_config.packages.len);
1000999
for (build_config.packages) |pkg| {
1001-
completions.putAssumeCapacity(.{
1000+
builder.completions.appendAssumeCapacity(.{
10021001
.label = pkg.name,
10031002
.kind = .Module,
10041003
.detail = pkg.path,
10051004
.sortText = try generateSortText(builder.arena, 4, pkg.name),
1006-
}, {});
1005+
});
10071006
}
10081007
}
10091008

0 commit comments

Comments
 (0)