Skip to content

Commit

Permalink
Filter not optional
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperAuguste committed May 28, 2024
1 parent 63ac820 commit 25ccfa4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/Server.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1644,13 +1644,12 @@ fn workspaceSymbolHandler(server: *Server, arena: std.mem.Allocator, request: ty

doc_loop: for (server.document_store.trigram_stores.keys(), server.document_store.trigram_stores.values()) |uri, trigram_store| {
const handle = server.document_store.getOrLoadHandle(uri) orelse continue;
if (trigram_store.filter == null) continue;

const tree = handle.tree;
const doc_scope = try handle.getDocumentScope();

for (trigrams.items) |trigram| {
if (!trigram_store.filter.?.contain(@bitCast(trigram))) continue :doc_loop;
if (!trigram_store.filter.contain(@bitCast(trigram))) continue :doc_loop;
}

candidate_decls_buffer.clearRetainingCapacity();
Expand Down
4 changes: 2 additions & 2 deletions src/TrigramStore.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const CompactingMultiList = @import("compacting_multi_list.zig").CompactingMulti
const TrigramStore = @This();

/// Fast lookup with false positives.
filter: ?fastfilter.BinaryFuse8,
filter: fastfilter.BinaryFuse8,
/// Map index is a slice in decls.
lookup: std.AutoArrayHashMapUnmanaged(Trigram, void),
decls: CompactingMultiList(Declaration.Index).Compacted,
Expand Down Expand Up @@ -114,7 +114,7 @@ pub fn reset(store: *TrigramStore, allocator: std.mem.Allocator) void {
}

pub fn deinit(store: *TrigramStore, allocator: std.mem.Allocator) void {
if (store.filter) |filter| filter.deinit(allocator);
store.filter.deinit(allocator);
store.lookup.deinit(allocator);
store.decls.deinit(allocator);
store.* = undefined;
Expand Down

0 comments on commit 25ccfa4

Please sign in to comment.