Closed samir-abis closed 1 month ago
Hi @samir-abis-everest , thanks for opening this. To clarify, you have a context provider with submenu items, but when you select the context provider, the submenu is empty?
Could you clarify what you mean by this?
might be? I'm not sure if it's related because I build the configurations in my extensions instead of Continue
There was a bug with config.ts related to us moving to a newer Typescript target but that was resolved and I don't believe would have an impact here.
Hi @Patrick-Erichsen.
you have a context provider with submenu items, but when you select the context provider, the submenu is empty?
Correct
Could you clarify what you mean by this?
I just tried out with a context provider directly in the config.ts
(the example one of the documentation, reading .md
files) and it works on the older build, while on the new build it still doesn't work.
Got it - mind sharing your config.ts as well?
const markdownContextProvider: CustomContextProvider = {
title: "markdown",
displayTitle: "Markdown Files",
description: "Access markdown files in your workspace",
type: "submenu",
async getContextItems(
query: string,
extras: ContextProviderExtras
): Promise<ContextItem[]> {
const { ide } = extras;
try {
const content = await ide.readFile(query);
return [
{
content,
name: query,
description: `Contents of ${query}`,
},
];
} catch (error) {
console.error(`Error reading file ${query}:`, error);
return [];
}
},
async loadSubmenuItems({
ide,
}: LoadSubmenuItemsArgs): Promise<ContextSubmenuItem[]> {
try {
const workspaceDirs = await ide.getWorkspaceDirs();
const allFiles = await Promise.all(
workspaceDirs.map((dir) => ide.subprocess(`find ${dir} -name "*.md"`))
);
const markdownFiles = allFiles
.flatMap((result) => result[0].split("\n"))
.filter((file) => file.trim() !== "");
return markdownFiles.map((file) => ({
id: file,
title: file.split("/").pop() || file,
description: file,
}));
} catch (error) {
console.error("Error loading markdown files:", error);
return [];
}
},
};
export default markdownContextProvider;
export function modifyConfig(config: Config): Config {
if (!config.contextProviders) {
config.contextProviders = [];
}
config.contextProviders.push(markdownContextProvider);
return config;
}
edit: corrected the code, now the prompt works. try it out
I've digged more through this in the debugger and this is the current status:
new version:
[2024-08-28T11:06:38] [DEBUG] Executing getSubmenuContextItems. Provider: lotse-context Query: Limit: 70
[2024-08-28T11:06:38] [DEBUG] Executing getSubmenuSearchResults. Provider: lotse-context Query:
[2024-08-28T11:06:38] [DEBUG] Current minisearches: []
[2024-08-28T11:06:38] [DEBUG] No minisearch found for provider: lotse-context
[2024-08-28T11:06:38] [DEBUG] Using fallback results: 0
old version:
[2024-08-28T11:08:46] [DEBUG] Logging initialized
[2024-08-28T11:09:12] [DEBUG] Executing getSubmenuContextItems. Provider: lotse-context Query: Limit: 70
[2024-08-28T11:09:12] [DEBUG] Executing getSubmenuSearchResults. Provider: lotse-context Query:
[2024-08-28T11:09:12] [DEBUG] Current minisearches: ["everest-nodes","everest-docs","lotse-context","markdown"]
[2024-08-28T11:09:12] [DEBUG] Search results for lotse-context: 0
[2024-08-28T11:09:12] [DEBUG] Using fallback results: 8
seems that minisearches are not being properly found/initialized, not even the one in the config.ts
Before submitting your bug report
Relevant environment info
Description
Seems in the recent versions of Continue preview, the context providers are not working anymore.
I implemented context providers through the API connection and they show in the list, but when I try to run them unfortunately they show no results.
@fry69 mentioned that there were recent changes to ESM for
config.ts
, might be a cause? Discussion here: https://discord.com/channels/1108621136150929458/1273194528513458248This wasn't the case a few builds ago.
here's an older build that runs the command with results
and here's a newer build:
To reproduce