Skip to content

Commit 7f10bd4

Browse files
committed
Remove #Selection symbol feature
- remove 'selection' symbol ├── apps │ └── editor │ └── src │ ├── commands │ │ ├── code-at-cursor-command │ │ │ ├── code-at-cursor-commands.ts │ │ │ └── utils │ │ │ └── perform-code-at-cursor.ts │ │ ├── select-definition-file-command.ts │ │ └── select-referencing-files-commands │ │ └── select-referencing-files-commands.ts │ ├── i18n │ │ └── translations │ │ └── views │ │ └── prompt │ │ └── handlers │ │ └── hash-sign.ts │ └── views │ └── prompt │ ├── backend │ │ ├── message-handlers │ │ │ ├── handle-hash-sign-quick-pick │ │ │ │ ├── handle-hash-sign-quick-pick.ts │ │ │ │ └── symbols │ │ │ │ └── index.ts │ │ │ ├── handle-open-file-and-select.ts │ │ │ └── handle-request-editor-selection-state.ts │ │ ├── prompt-view-provider.ts │ │ └── utils │ │ └── symbols │ │ └── replace-symbols.ts │ ├── frontend │ │ ├── Main │ │ │ ├── Main.tsx │ │ │ └── MainView │ │ │ └── MainView.tsx │ │ ├── Prompt.tsx │ │ └── hooks │ │ └── use-editor-sync.ts │ └── types │ └── messages.ts └── packages ├── shared │ └── src │ ├── constants │ │ └── dictionary.ts │ └── utils │ └── simplify-prompt-symbols │ ├── simplify-prompt-symbols.spec.ts │ └── simplify-prompt-symbols.ts └── ui └── src └── components └── editor └── common └── prompts ├── PromptField │ ├── PromptField.stories.tsx │ ├── PromptField.tsx │ └── hooks │ └── use-handlers │ ├── handle-paste.ts │ └── utils.ts └── shared └── symbols ├── get-highlighted-text.tsx ├── position-mapping.ts ├── prompt-symbols.module.scss ├── reconstruct-raw-value.ts └── use-symbol-deletion.ts
1 parent a6e79cc commit 7f10bd4

16 files changed

Lines changed: 28 additions & 271 deletions

File tree

‎apps/editor/src/i18n/translations/views/prompt/handlers/hash-sign.ts‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -163,42 +163,6 @@ export const translations = {
163163
hu: 'Nem találhatók képességek a(z) {0} számára.',
164164
bg: 'Не са намерени умения за {0}.'
165165
},
166-
'views.prompt.handlers.hash-sign.quick-pick.selection.label': {
167-
en: 'Selection',
168-
pl: 'Zaznaczenie',
169-
'zh-cn': '选择',
170-
ja: '選択',
171-
'zh-tw': '選擇',
172-
de: 'Auswahl',
173-
es: 'Selección',
174-
fr: 'Sélection',
175-
'pt-br': 'Seleção',
176-
ru: 'Выделение',
177-
ko: '선택',
178-
it: 'Selezione',
179-
tr: 'Seçim',
180-
cs: 'Výběr',
181-
hu: 'Kijelölés',
182-
bg: 'Селекция'
183-
},
184-
'views.prompt.handlers.hash-sign.quick-pick.selection.description': {
185-
en: 'Text selection from the active editor',
186-
pl: 'Zaznaczenie tekstu z aktywnego edytora',
187-
'zh-cn': '来自活动编辑器的文本选择',
188-
ja: 'アクティブなエディターからのテキスト選択',
189-
'zh-tw': '來自活動編輯器的文本選擇',
190-
de: 'Textauswahl aus dem aktiven Editor',
191-
es: 'Selección de texto del editor activo',
192-
fr: "Sélection de texte de l'éditeur actif",
193-
'pt-br': 'Seleção de texto do editor ativo',
194-
ru: 'Выделение текста из активного редактора',
195-
ko: '활성 편집기의 텍스트 선택',
196-
it: "Selezione di testo dall'editor attivo",
197-
tr: 'Aktif editörden metin seçimi',
198-
cs: 'Výběr textu z aktivního editoru',
199-
hu: 'Szövegkijelölés az aktív szerkesztőből',
200-
bg: 'Избор на текст от активния редактор'
201-
},
202166
'views.prompt.handlers.hash-sign.quick-pick.changes.label': {
203167
en: 'Changes',
204168
pl: 'Zmiany',

‎apps/editor/src/views/prompt/backend/message-handlers/handle-hash-sign-quick-pick/handle-hash-sign-quick-pick.ts‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ import { t } from '@/i18n'
33
import { PromptViewProvider } from '@/views/prompt/backend/prompt-view-provider'
44
import { LAST_SELECTED_SYMBOL_STATE_KEY } from '@/constants/state-keys'
55
import {
6-
handle_selection_item,
76
handle_changes_item,
87
handle_commit_item,
98
handle_saved_context_item,
109
handle_skill_item
1110
} from './symbols'
1211

13-
const selection_label = `$(list-flat) ${t('views.prompt.handlers.hash-sign.quick-pick.selection.label')}`
1412
const changes_label = `$(git-pull-request-draft) ${t('views.prompt.handlers.hash-sign.quick-pick.changes.label')}`
1513
const commit_label = `$(git-commit) ${t('views.prompt.handlers.hash-sign.quick-pick.commit.label')}`
1614
const saved_context_label = `$(checklist) ${t('views.prompt.handlers.hash-sign.quick-pick.saved-context.label')}`
@@ -21,12 +19,6 @@ const hash_sign_quick_pick = async (params: {
2119
on_insert: (text: string) => void
2220
}): Promise<string | undefined> => {
2321
const items: vscode.QuickPickItem[] = [
24-
{
25-
label: selection_label,
26-
description: t(
27-
'views.prompt.handlers.hash-sign.quick-pick.selection.description'
28-
)
29-
},
3022
{
3123
label: changes_label,
3224
description: t(
@@ -127,9 +119,6 @@ const hash_sign_quick_pick = async (params: {
127119
let result: string | 'continue' | undefined
128120

129121
switch (selected.label) {
130-
case selection_label:
131-
result = await handle_selection_item()
132-
break
133122
case changes_label:
134123
result = await handle_changes_item(params.extension_context)
135124
break

‎apps/editor/src/views/prompt/backend/message-handlers/handle-hash-sign-quick-pick/symbols/index.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from './selection-symbol'
21
export * from './changes-symbol'
32
export * from './commit-symbol'
43
export * from './saved-context-symbol'

‎apps/editor/src/views/prompt/backend/message-handlers/handle-hash-sign-quick-pick/symbols/selection-symbol.ts‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎apps/editor/src/views/prompt/backend/utils/symbols/replace-symbols.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
replace_commit_symbol
66
} from './git/replace-git-symbols'
77
import { replace_saved_context_symbol } from './saved-context/replace-saved-context-symbol'
8-
import { replace_selection_symbol } from './selection/replace-selection-symbol'
98
import { replace_skill_symbol } from './skill/replace-skill-symbol'
109
import { replace_image_symbol } from './image/replace-image-symbol'
1110
import { replace_pasted_text_symbol } from './pasted-text/replace-pasted-text-symbol'
@@ -23,10 +22,6 @@ export const replace_symbols = async (params: {
2322
let processed_instructions = params.instructions
2423
let skill_definitions = ''
2524

26-
if (processed_instructions.includes('#Selection')) {
27-
processed_instructions = replace_selection_symbol(processed_instructions)
28-
}
29-
3025
if (processed_instructions.includes('#Changes(')) {
3126
const result = await replace_changes_symbol({
3227
instruction: processed_instructions,

‎apps/editor/src/views/prompt/backend/utils/symbols/selection/replace-selection-symbol.ts‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎packages/shared/src/constants/dictionary.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export const dictionary = {
1616
commit_hash: string
1717
) =>
1818
`No checked files in the "${folder_name}" repository for commit ${commit_hash}.`,
19-
NO_TEXT_SELECTED_FOR_SELECTION_PLACEHOLDER:
20-
'No text selected for #Selection placeholder.',
2119
RESTORED_CONTEXT: (context_name: string) =>
2220
`Restored context "${context_name}".`,
2321
NO_GIT_REPOSITORY_FOUND_IN_WORKSPACE:

‎packages/shared/src/utils/simplify-prompt-symbols/simplify-prompt-symbols.spec.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ describe('simplify_prompt_symbols', () => {
1515
)
1616
})
1717

18-
it('should replace #Selection', () => {
19-
const prompt = 'What about #Selection?'
20-
expect(simplify_prompt_symbols({ prompt })).toBe('What about [Selection]?')
21-
})
22-
2318
it('should replace #Changes', () => {
2419
const prompt = 'Review #Changes(main)'
2520
expect(simplify_prompt_symbols({ prompt })).toBe('Review [Changes]')
@@ -56,9 +51,9 @@ describe('simplify_prompt_symbols', () => {
5651
})
5752

5853
it('should handle multiple replacements', () => {
59-
const prompt = '#Selection and #Fragment(a.ts:1:1-2:2) with #Changes(dev)'
54+
const prompt = '#Fragment(a.ts:1:1-2:2) with #Changes(dev)'
6055
expect(simplify_prompt_symbols({ prompt })).toBe(
61-
'[Selection] and [Fragment] with [Changes]'
56+
'[Fragment] with [Changes]'
6257
)
6358
})
6459
})

‎packages/shared/src/utils/simplify-prompt-symbols/simplify-prompt-symbols.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export const simplify_prompt_symbols = (params: { prompt: string }): string => {
77
/#Fragment\(.+?:\d+:\d+-\d+:\d+\)/g,
88
'[Fragment]'
99
)
10-
simplified = simplified.replace(/#Selection/g, '[Selection]')
1110
simplified = simplified.replace(/#Changes\([^)]+\)/g, '[Changes]')
1211
simplified = simplified.replace(
1312
/#SavedContext\((?:WorkspaceState|JSON) "(?:\\.|[^"\\])*"\)/g,

‎packages/ui/src/components/editor/common/prompts/PromptField/PromptField.stories.tsx‎

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -270,78 +270,6 @@ export const WithPlaceholderSavedContext = () => (
270270
/>
271271
)
272272

273-
export const WithPlaceholderSelection = () => (
274-
<PromptField
275-
value="Ask about the #Selection"
276-
chat_history={[]}
277-
on_change={(value) => console.log('Changed:', value)}
278-
on_submit={() => console.log('Submitted')}
279-
on_copy={() => console.log('Copied')}
280-
is_connected={true}
281-
is_action_disabled={false}
282-
current_selection={{
283-
text: 'Selected text content',
284-
start_line: 1,
285-
start_col: 1,
286-
end_line: 1,
287-
end_col: 22
288-
}}
289-
currently_open_file_path="/path/to/file"
290-
on_caret_position_change={(pos) => console.log('Caret position:', pos)}
291-
target={TARGET.API}
292-
on_target_change={(target) => console.log('Target changed:', target)}
293-
on_at_sign_click={() => console.log('@ clicked')}
294-
on_hash_sign_click={() => console.log('# clicked')}
295-
is_web_target={false}
296-
on_submit_with_control={() => console.log('Submitted with control')}
297-
selected_files={[]}
298-
on_go_to_file={(path) => console.log('Go to file:', path)}
299-
on_slash_click={() => {}}
300-
on_pasted_lines_click={(path, start, end) =>
301-
console.log('Pasted lines clicked:', path, start, end)
302-
}
303-
on_open_url={(url) => console.log('Open URL:', url)}
304-
on_open_website={(url) => console.log('Open website:', url)}
305-
on_paste_image={(content) => console.log('Paste image:', content)}
306-
on_paste_long_text={(content) => console.log('Paste long text:', content)}
307-
on_open_image={(hash) => console.log('Open image:', hash)}
308-
on_open_pasted_text={(hash) => console.log('Open pasted text:', hash)}
309-
on_paste_url={(url) => console.log('Paste URL:', url)}
310-
is_recording={false}
311-
on_recording_started={() => console.log('Recording started')}
312-
on_recording_finished={() => console.log('Recording finished')}
313-
tabs_count={1}
314-
active_tab_index={0}
315-
on_tab_change={() => {}}
316-
on_new_tab={() => {}}
317-
on_tab_delete={() => {}}
318-
prompt_token_count={0}
319-
translations={{
320-
voice_input: 'Voice input',
321-
stop_recording: 'Stop recording',
322-
reference_file: 'Reference file',
323-
insert_symbol: 'Insert symbol',
324-
use_template: 'Use template',
325-
edit_format: 'Edit format',
326-
edit_format_whole: 'Whole-File Overwrite',
327-
edit_format_search_replace: 'Search & Replace',
328-
edit_format_diff: 'Unified Diff',
329-
edit_format_truncated: 'Ellipsis truncations',
330-
placeholder_code_history: 'Optional instructions (⇅ for history)',
331-
placeholder_code: 'Optional instructions',
332-
placeholder_history: 'Type instructions (⇅ for history)',
333-
placeholder_default: 'Type instructions',
334-
send_with: 'Send with',
335-
send_with_ellipsis: 'Send with...',
336-
copy_prompt: 'Copy prompt',
337-
preview_prompt: 'Preview prompt',
338-
send: 'Send',
339-
attach_selected_files: 'Attach selected files',
340-
target: 'Target'
341-
}}
342-
/>
343-
)
344-
345273
export const WithCommit = () => (
346274
<PromptField
347275
value='Ask about #Commit(my-repo:a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0 "Initial commit")'

0 commit comments

Comments
 (0)