Skip to content

Commit 57cc5d0

Browse files
authored
Add workspace search filters and CamelCase ranking (#73)
- support include/exclude glob patterns in workspace search - improve query matching to favor CamelCase boundary hits - add search UI in the file tree with deferred results
1 parent 37675c6 commit 57cc5d0

5 files changed

Lines changed: 723 additions & 62 deletions

File tree

apps/server/src/workspaceEntries.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,39 @@ describe("searchWorkspaceEntries", () => {
133133
assert.include(paths, "src/components/Composer.tsx");
134134
});
135135

136+
it("prefers CamelCase boundary matches over lowercase substrings", async () => {
137+
const cwd = makeTempDir("okcode-workspace-camel-query-");
138+
writeFile(cwd, "src/components/CodeViewerPanel.tsx");
139+
writeFile(cwd, "docs/cvp-reference.md");
140+
writeFile(cwd, "src/components/code-view-panel.txt");
141+
142+
const result = await searchWorkspaceEntries({ cwd, query: "CVP", limit: 10 });
143+
144+
assert.equal(result.entries[0]?.path, "src/components/CodeViewerPanel.tsx");
145+
});
146+
147+
it("supports VS Code-style include and exclude glob filters", async () => {
148+
const cwd = makeTempDir("okcode-workspace-glob-query-");
149+
writeFile(cwd, "src/components/CodeViewerPanel.tsx");
150+
writeFile(cwd, "src/components/CodeViewerPanel.test.tsx");
151+
writeFile(cwd, "docs/CodeViewerPanel.md");
152+
writeFile(cwd, "dist/CodeViewerPanel.tsx");
153+
154+
const result = await searchWorkspaceEntries({
155+
cwd,
156+
query: "",
157+
includePattern: "src/**",
158+
excludePattern: "**/*.test.tsx",
159+
limit: 100,
160+
});
161+
const paths = result.entries.map((entry) => entry.path);
162+
163+
assert.include(paths, "src/components/CodeViewerPanel.tsx");
164+
assert.notInclude(paths, "src/components/CodeViewerPanel.test.tsx");
165+
assert.notInclude(paths, "docs/CodeViewerPanel.md");
166+
assert.notInclude(paths, "dist/CodeViewerPanel.tsx");
167+
});
168+
136169
it("tracks truncation without sorting every fuzzy match", async () => {
137170
const cwd = makeTempDir("okcode-workspace-fuzzy-limit-");
138171
writeFile(cwd, "src/components/Composer.tsx");

0 commit comments

Comments
 (0)