Elffuss BraidHub

kikocis/continue public

0a1f7aa3091d · 1.5 KiBRawPermalink
1import {
2 ContextItem,
3 ContextProviderDescription,
4 ContextProviderExtras,
5} from "../../index.js";
6import { BaseContextProvider } from "../index.js";
7
8class CodeOutlineContextProvider extends BaseContextProvider {
9 static description: ContextProviderDescription = {
10 title: "outline",
11 displayTitle: "Outline",
12 description: "Definition lines only (from open files)",
13 type: "normal",
14 renderInlineAs: "",
15 };
16
17 async getContextItems(
18 query: string,
19 extras: ContextProviderExtras,
20 ): Promise<ContextItem[]> {
21 const ide = extras.ide;
22 const openFiles = await ide.getOpenFiles();
23 // const allFiles: { name: string; absPath: string; content: string }[] =
24 // await Promise.all(
25 // openFiles.map(async (filepath: string) => {
26 // return {
27 // name: getBasename(filepath),
28 // absPath: filepath,
29 // content: `${await ide.readFile(filepath)}`,
30 // };
31 // }),
32 // );
33 // const outlines = await getOutlines(
34 // allFiles
35 // .filter((file) => file.content.length > 0)
36 // .map((file) => {
37 // return {
38 // relPath: file.name,
39 // code: file.content,
40 // };
41 // })
42 // );
43 // return [
44 // {
45 // content: outlines ? outlines : "",
46 // name: "Code Outline",
47 // description: "Definition lines only (from open files)",
48 // },
49 // ];
50 return [];
51 }
52
53 async load(): Promise<void> {}
54}
55
56export default CodeOutlineContextProvider;