diff --git a/core/core.ts b/core/core.ts index 9ca9108df9..822bc6f7ee 100644 --- a/core/core.ts +++ b/core/core.ts @@ -735,6 +735,7 @@ export class Core { tool, toolCallId: toolCall.id, onPartialOutput, + core: this, // Add a reference to the Core instance }); }); @@ -1075,7 +1076,7 @@ export class Core { this.indexingCancellationController = undefined; } - private async refreshCodebaseIndexFiles(files: string[]) { + async refreshCodebaseIndexFiles(files: string[]) { // Can be cancelled by codebase index but not vice versa if ( this.indexingCancellationController && @@ -1103,7 +1104,7 @@ export class Core { } this.messenger.send("refreshSubmenuItems", { - providers: "dependsOnIndexing", + providers: "all", }); this.indexingCancellationController = undefined; } diff --git a/core/index.d.ts b/core/index.d.ts index e781aa5a53..99761f5bd5 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -6,6 +6,7 @@ import { import Parser from "web-tree-sitter"; import { LLMConfigurationStatuses } from "./llm/constants"; import { GetGhTokenArgs } from "./protocol/ide"; +import { Core } from "./core"; declare global { interface Window { @@ -972,6 +973,7 @@ export interface ToolExtras { toolCallId: string; contextItems: ContextItem[]; }) => void; + core?: Core; // Reference to the Core instance } export interface Tool { diff --git a/core/tools/implementations/createNewFile.ts b/core/tools/implementations/createNewFile.ts index 5a89141eb3..4e211b32e5 100644 --- a/core/tools/implementations/createNewFile.ts +++ b/core/tools/implementations/createNewFile.ts @@ -17,6 +17,10 @@ export const createNewFileImpl: ToolImpl = async (args, extras) => { } await extras.ide.writeFile(resolvedFileUri, args.contents); await extras.ide.openFile(resolvedFileUri); + await extras.ide.saveFile(resolvedFileUri); + if (extras.core) { + await extras.core.refreshCodebaseIndexFiles([resolvedFileUri]); + } return [ { name: getUriPathBasename(resolvedFileUri),