feat: add filepath to apply prompt template vars

This commit is contained in:
Nate 2025-09-09 21:59:48 -07:00
parent 3a4c6c310d
commit fc4828d010

View file

@ -13,6 +13,7 @@ import { VsCodeWebviewProtocol } from "../../webviewProtocol";
import { ApplyAbortManager } from "core/edit/applyAbortManager";
import { EDIT_MODE_STREAM_ID } from "core/edit/constants";
import { stripImages } from "core/util/messageContent";
import { getLastNPathParts } from "core/util/uri";
import { editOutcomeTracker } from "../../extension/EditOutcomeTracker";
import { VerticalDiffHandler, VerticalDiffHandlerOptions } from "./handler";
@ -432,9 +433,11 @@ export class VerticalDiffManager {
let overridePrompt: ChatMessage[] | undefined;
if (llm.promptTemplates?.apply) {
const filepath = getLastNPathParts(fileUri, 1);
const rendered = llm.renderPromptTemplate(llm.promptTemplates.apply, [], {
original_code: rangeContent,
new_code: newCode ?? "",
filepath,
});
overridePrompt =
typeof rendered === "string"