import { getBasename } from "../../util/index.js";
import { BaseContextProvider } from "../index.js";
// import { getHighlightsThatFit, ILLMContextSizer } from "llm-code-highlighter/dist/index.continue";
const HIGHLIGHTS_TOKEN_BUDGET = 2000;
class CodeHighlightsContextProvider extends BaseContextProvider {
    static description = {
        title: "highlights",
        displayTitle: "Highlights",
        description: "Code highlights from open files",
        type: "normal",
    };
    async getContextItems(query, extras) {
        const ide = extras.ide;
        const openFiles = await ide.getOpenFiles();
        const allFiles = await Promise.all(openFiles.map(async (filepath) => {
            return {
                name: getBasename(filepath),
                absPath: filepath,
                content: `${await ide.readFile(filepath)}`,
            };
        }));
        // const contextSizer =  {
        //   fits(content: string): boolean {
        //     return countTokens(content, "") < HIGHLIGHTS_TOKEN_BUDGET;
        //   }
        // } as ILLMContextSizer
        // const repoMap = await getHighlightsThatFit(
        //   contextSizer,
        //   [],
        //   allFiles
        //     .filter((file) => file.content.length > 0)
        //     .map((file) => {
        //       return {
        //         relPath: file.name,
        //         code: file.content,
        //       };
        //     })
        // );
        // return [
        //   {
        //     content: repoMap ? repoMap : "",
        //     name: "Code Highlights",
        //     description: "Code highlights from open files",
        //   },
        // ];
        return [];
    }
    async load() { }
}
export default CodeHighlightsContextProvider;
