import { getBasename, getLastNPathParts } from "../../util/index.js";
import { BaseContextProvider } from "../index.js";
class FolderContextProvider extends BaseContextProvider {
    static description = {
        title: "folder",
        displayTitle: "Folder",
        description: "Type to search",
        type: "submenu",
    };
    async getContextItems(query, extras) {
        const { retrieveContextItemsFromEmbeddings } = await import("../retrieval/retrieval");
        return retrieveContextItemsFromEmbeddings(extras, this.options, query);
    }
    async loadSubmenuItems(args) {
        const folders = await args.ide.listFolders();
        return folders.map((folder) => {
            return {
                id: folder,
                title: getBasename(folder),
                description: getLastNPathParts(folder, 2),
            };
        });
    }
}
export default FolderContextProvider;
