Skip to content

Commit

Permalink
refactor(prompt): remove wrapJoinedMentions parameter from selectedCo…
Browse files Browse the repository at this point in the history
…dePromptWithExtraFiles

This change simplifies the selectedCodePromptWithExtraFiles function by:
- Removing the optional wrapJoinedMentions parameter
- Always joining mentions with a simple space separator
- Removing the conditional wrapping of mentions with parentheses
  • Loading branch information
ichim-david committed Feb 7, 2025
1 parent 6e45741 commit 46b9fa0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions vscode/src/commands/execute/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ export async function executeDefaultCommand(

export function selectedCodePromptWithExtraFiles(
primary: ContextItem,
other: ContextItem[],
wrapJoinedMentions = true
other: ContextItem[]
): PromptString {
const primaryMention = ps`@${PromptString.fromDisplayPathLineRange(primary.uri, primary.range)}`
const otherMentions = other.map(
Expand All @@ -82,7 +81,5 @@ export function selectedCodePromptWithExtraFiles(
}

const joinedMentions = PromptString.join(otherMentions, ps` `)
return ps`${primaryMention}${
wrapJoinedMentions ? ps` ( ${joinedMentions} )` : ps` ${joinedMentions}`
}`
return ps`${primaryMention} ${joinedMentions}`
}
2 changes: 1 addition & 1 deletion vscode/src/prompts/prompt-hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ async function hydrateWithOpenTabs(promptText: PromptString): Promise<[PromptStr
return [
promptText.replaceAll(
PROMPT_EDITOR_OPEN_TABS_PLACEHOLDER,
selectedCodePromptWithExtraFiles(firstOpenTab, otherOpenTabs, false)
selectedCodePromptWithExtraFiles(firstOpenTab, otherOpenTabs)
),
[firstOpenTab, ...otherOpenTabs],
]
Expand Down

0 comments on commit 46b9fa0

Please sign in to comment.