Skip to content

Commit 27b7787

Browse files
committed
Remove automatic prompt appending from git commit input box
- should not place prompts into the commit message field in scm as we stage files └── apps └── editor └── src └── services └── git-discard-file-watcher.ts
1 parent f154464 commit 27b7787

1 file changed

Lines changed: 0 additions & 51 deletions

File tree

‎apps/editor/src/services/git-discard-file-watcher.ts‎

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as vscode from 'vscode'
22
import * as path from 'path'
33
import { PromptsForCommitMessagesUtils } from '../utils/prompts-for-commit-messages-utils'
4-
import { simplify_prompt_symbols } from '@shared/utils/simplify-prompt-symbols'
54

65
export const setup_git_discard_file_watcher = (
76
extension_context: vscode.ExtensionContext
@@ -17,7 +16,6 @@ export const setup_git_discard_file_watcher = (
1716
const git_api = git_extension.exports.getAPI(1)
1817

1918
const repo_states = new Map<string, Set<string>>()
20-
const previous_prompts_text_map = new Map<string, string>()
2119

2220
const update_repo_state = (repo: any) => {
2321
const workspace_root = repo.rootUri.fsPath
@@ -53,55 +51,6 @@ export const setup_git_discard_file_watcher = (
5351
}
5452

5553
repo_states.set(workspace_root, current_changes)
56-
57-
const select_prompts_setting = vscode.workspace
58-
.getConfiguration('codeWebChat')
59-
.get<boolean>('selectAllPromptsInCommitMessagesByDefault', true)
60-
61-
let relevant_prompts_text = ''
62-
63-
if (select_prompts_setting) {
64-
const all_prompts =
65-
PromptsForCommitMessagesUtils.load_all(extension_context)[
66-
workspace_root
67-
] || []
68-
const staged_files = (repo.state.indexChanges || []).map(
69-
(change: any) =>
70-
path
71-
.relative(workspace_root, change.uri.fsPath)
72-
.replace(/\\/g, '/')
73-
)
74-
75-
const relevant_prompts = all_prompts.filter((p) =>
76-
p.files.some((file) => staged_files.includes(file))
77-
)
78-
79-
if (relevant_prompts.length > 0) {
80-
relevant_prompts_text =
81-
'\n\n' +
82-
relevant_prompts
83-
.map(
84-
(p) => `- ${simplify_prompt_symbols({ prompt: p.prompt })}`
85-
)
86-
.join('\n')
87-
}
88-
}
89-
90-
const previous_text =
91-
previous_prompts_text_map.get(workspace_root) || ''
92-
93-
if (previous_text !== relevant_prompts_text) {
94-
let current_value = repo.inputBox.value
95-
96-
if (previous_text && current_value.includes(previous_text)) {
97-
current_value = current_value.replace(previous_text, '')
98-
}
99-
100-
current_value = current_value.trimEnd()
101-
102-
repo.inputBox.value = current_value + relevant_prompts_text
103-
previous_prompts_text_map.set(workspace_root, relevant_prompts_text)
104-
}
10554
}
10655

10756
for (const repo of git_api.repositories) {

0 commit comments

Comments
 (0)