mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-26 11:16:14 +01:00
core: fix file search limit handling and ensure File module initialization
This commit is contained in:
@@ -250,7 +250,7 @@ export namespace File {
|
||||
log.info("search", { query: input.query })
|
||||
const limit = input.limit ?? 100
|
||||
const result = await state().then((x) => x.files())
|
||||
if (!input.query) return result.dirs.toSorted()
|
||||
if (!input.query) return result.dirs.toSorted().slice(0, limit)
|
||||
const items = [...result.files, ...result.dirs]
|
||||
const sorted = fuzzysort.go(input.query, items, { limit: limit }).map((r) => r.target)
|
||||
log.info("search", { query: input.query, results: sorted.length })
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Format } from "../format"
|
||||
import { LSP } from "../lsp"
|
||||
import { Snapshot } from "../snapshot"
|
||||
import { FileWatcher } from "../file/watcher"
|
||||
import { File } from "../file"
|
||||
|
||||
export async function InstanceBootstrap() {
|
||||
await Plugin.init()
|
||||
@@ -12,4 +13,5 @@ export async function InstanceBootstrap() {
|
||||
LSP.init()
|
||||
Snapshot.init()
|
||||
FileWatcher.init()
|
||||
File.init()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user