Skip to content

Commit ac24451

Browse files
committed
Update copy paths format settings to support bullet list, comma-separated, and ASCII tree options
- 1) add the ability to format copied paths in 'comma-separated' style. name it 'comma-separated'. place it as second option. 2) rename 'tree' to 'ascii tree' 3) rename 'list' to 'bullet list' - consitently rename 'list' to 'bullet list' - consitently rename 'tree' to 'ascii tree' (including translations)
1 parent ea76f58 commit ac24451

8 files changed

Lines changed: 90 additions & 53 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,10 +919,11 @@
919919
"type": "string",
920920
"scope": "resource",
921921
"enum": [
922-
"list",
923-
"tree"
922+
"bullet-list",
923+
"comma-separated",
924+
"ascii-tree"
924925
],
925-
"default": "list"
926+
"default": "bullet-list"
926927
},
927928
"codeWebChat.sendWithShiftEnter": {
928929
"type": "boolean",

‎apps/editor/src/commands/copy-paths-command.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ const print_tree = (node: TreeNode, prefix = ''): string[] => {
3939

4040
const format_paths = (files: string[]) => {
4141
const config = vscode.workspace.getConfiguration('codeWebChat')
42-
const format = config.get<'list' | 'tree'>('copyPathsFormat', 'list')
42+
const format = config.get<'bullet-list' | 'comma-separated' | 'ascii-tree'>(
43+
'copyPathsFormat',
44+
'bullet-list'
45+
)
4346

4447
const workspace_folders = vscode.workspace.workspaceFolders
4548
const is_multi_root = !!workspace_folders && workspace_folders.length > 1
@@ -62,9 +65,11 @@ const format_paths = (files: string[]) => {
6265
return display_path.replace(/\\/g, '/')
6366
})
6467

65-
if (format == 'tree') {
68+
if (format == 'ascii-tree') {
6669
const root = build_tree(display_paths)
6770
return print_tree(root).join('\n')
71+
} else if (format == 'comma-separated') {
72+
return display_paths.map((display_path) => `\`${display_path}\``).join(', ')
6873
}
6974

7075
return display_paths.map((display_path) => `- \`${display_path}\``).join('\n')

‎apps/editor/src/views/settings/backend/message-handlers/handle-get-copy-paths-format.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ export const handle_get_copy_paths_format = async (
55
provider: SettingsProvider
66
): Promise<void> => {
77
const config = vscode.workspace.getConfiguration('codeWebChat')
8-
const value = config.get<'list' | 'tree'>('copyPathsFormat', 'list')
8+
const value = config.get<'bullet-list' | 'comma-separated' | 'ascii-tree'>(
9+
'copyPathsFormat',
10+
'bullet-list'
11+
)
912
provider.postMessage({
1013
command: 'COPY_PATHS_FORMAT',
1114
value

‎apps/editor/src/views/settings/frontend/Home/Home.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ type Props = {
124124
checkpoint_lifespan: number
125125
edit_format_instructions: EditFormatInstructions
126126
clear_checks_in_workspace_behavior: 'ignore-open-editors' | 'uncheck-all'
127-
copy_paths_format: 'list' | 'tree'
127+
copy_paths_format: 'bullet-list' | 'comma-separated' | 'ascii-tree'
128128
auto_run_intelligent_update: boolean
129129
set_providers: (providers: Provider[]) => void
130130
set_api_configurations: (configurations: ApiConfiguration[]) => void
@@ -151,7 +151,9 @@ type Props = {
151151
on_clear_checks_in_workspace_behavior_change: (
152152
value: 'ignore-open-editors' | 'uncheck-all'
153153
) => void
154-
on_copy_paths_format_change: (value: 'list' | 'tree') => void
154+
on_copy_paths_format_change: (
155+
value: 'bullet-list' | 'comma-separated' | 'ascii-tree'
156+
) => void
155157
on_auto_run_intelligent_update_change: (enabled: boolean) => void
156158
on_open_keybindings: (search?: string) => void
157159
on_open_editor_settings: () => void

‎apps/editor/src/views/settings/frontend/Home/sections/GeneralSection.tsx‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ type Props = {
4141
on_clear_checks_in_workspace_behavior_change: (
4242
value: ClearChecksBehavior
4343
) => void
44-
copy_paths_format: 'list' | 'tree'
45-
on_copy_paths_format_change: (value: 'list' | 'tree') => void
44+
copy_paths_format: 'bullet-list' | 'comma-separated' | 'ascii-tree'
45+
on_copy_paths_format_change: (
46+
value: 'bullet-list' | 'comma-separated' | 'ascii-tree'
47+
) => void
4648
on_edit_format_instructions_change: (
4749
instructions: EditFormatInstructions
4850
) => void
@@ -259,12 +261,16 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
259261
<UiDropdown
260262
options={[
261263
{
262-
value: 'list',
263-
label: t('general.copy-paths-format.list')
264+
value: 'bullet-list',
265+
label: t('general.copy-paths-format.bullet-list')
266+
},
267+
{
268+
value: 'comma-separated',
269+
label: t('general.copy-paths-format.comma-separated')
264270
},
265271
{
266-
value: 'tree',
267-
label: t('general.copy-paths-format.tree')
272+
value: 'ascii-tree',
273+
label: t('general.copy-paths-format.ascii-tree')
268274
}
269275
]}
270276
value={props.copy_paths_format}

‎apps/editor/src/views/settings/frontend/hooks/use-settings.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const use_settings = (vscode: any) => {
6464
set_clear_checks_in_workspace_behavior
6565
] = useState<'ignore-open-editors' | 'uncheck-all' | undefined>(undefined)
6666
const [copy_paths_format, set_copy_paths_format] = useState<
67-
'list' | 'tree' | undefined
67+
'bullet-list' | 'comma-separated' | 'ascii-tree' | undefined
6868
>(undefined)
6969
const [auto_run_intelligent_update, set_auto_run_intelligent_update] =
7070
useState<boolean | undefined>(undefined)
@@ -360,7 +360,9 @@ export const use_settings = (vscode: any) => {
360360
})
361361
}
362362

363-
const handle_copy_paths_format_change = (value: 'list' | 'tree') => {
363+
const handle_copy_paths_format_change = (
364+
value: 'bullet-list' | 'comma-separated' | 'ascii-tree'
365+
) => {
364366
set_copy_paths_format(value)
365367
post_message(vscode, {
366368
command: 'UPDATE_COPY_PATHS_FORMAT',

‎apps/editor/src/views/settings/frontend/i18n/translations/general.ts‎

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -511,41 +511,59 @@ export const translations = {
511511
hu: 'A másolt útvonalak kimeneti formátuma.',
512512
bg: 'Изходен формат на копираните пътища.'
513513
},
514-
'general.copy-paths-format.list': {
515-
en: 'List',
516-
pl: 'Lista',
517-
'zh-cn': '列表',
518-
ja: 'リスト',
519-
'zh-tw': '清單',
520-
de: 'Liste',
521-
es: 'Lista',
522-
fr: 'Liste',
523-
'pt-br': 'Lista',
524-
ru: 'Список',
525-
ko: '목록',
526-
it: 'Elenco',
527-
tr: 'Liste',
528-
cs: 'Seznam',
529-
hu: 'Lista',
530-
bg: 'Списък'
531-
},
532-
'general.copy-paths-format.tree': {
533-
en: 'Tree',
534-
pl: 'Drzewo',
535-
'zh-cn': '树',
536-
ja: 'ツリー',
537-
'zh-tw': '樹',
538-
de: 'Baum',
539-
es: 'Árbol',
540-
fr: 'Arbre',
541-
'pt-br': 'Árvore',
542-
ru: 'Дерево',
543-
ko: '트리',
544-
it: 'Albero',
545-
tr: 'Ağaç',
546-
cs: 'Strom',
547-
hu: 'Fa',
548-
bg: 'Дърво'
514+
'general.copy-paths-format.bullet-list': {
515+
en: 'Bullet List',
516+
pl: 'Lista punktowana',
517+
'zh-cn': '项目符号列表',
518+
ja: '箇条書きリスト',
519+
'zh-tw': '項目符號清單',
520+
de: 'Aufzählungsliste',
521+
es: 'Lista de viñetas',
522+
fr: 'Liste à puces',
523+
'pt-br': 'Lista com marcadores',
524+
ru: 'Маркированный список',
525+
ko: '글머리 기호 목록',
526+
it: 'Elenco puntato',
527+
tr: 'Madde İşaretli Liste',
528+
cs: 'Odrážkový seznam',
529+
hu: 'Felsorolásos lista',
530+
bg: 'Списък с водещи символи'
531+
},
532+
'general.copy-paths-format.comma-separated': {
533+
en: 'Comma-separated',
534+
pl: 'Oddzielone przecinkami',
535+
'zh-cn': '逗号分隔',
536+
ja: 'カンマ区切り',
537+
'zh-tw': '逗號分隔',
538+
de: 'Kommagetrennt',
539+
es: 'Separado por comas',
540+
fr: 'Séparé par des virgules',
541+
'pt-br': 'Separado por vírgulas',
542+
ru: 'Через запятую',
543+
ko: '쉼표로 구분',
544+
it: 'Separato da virgole',
545+
tr: 'Virgülle ayrılmış',
546+
cs: 'Oddělené čárkami',
547+
hu: 'Vesszővel elválasztva',
548+
bg: 'Разделени със запетая'
549+
},
550+
'general.copy-paths-format.ascii-tree': {
551+
en: 'ASCII Tree',
552+
pl: 'Drzewo ASCII',
553+
'zh-cn': 'ASCII 树',
554+
ja: 'ASCII ツリー',
555+
'zh-tw': 'ASCII 樹',
556+
de: 'ASCII-Baum',
557+
es: 'Árbol ASCII',
558+
fr: 'Arbre ASCII',
559+
'pt-br': 'Árvore ASCII',
560+
ru: 'ASCII-дерево',
561+
ko: 'ASCII 트리',
562+
it: 'Albero ASCII',
563+
tr: 'ASCII Ağacı',
564+
cs: 'ASCII Strom',
565+
hu: 'ASCII Fa',
566+
bg: 'ASCII дърво'
549567
},
550568
'general.prompt-field.title': {
551569
en: 'Prompt Field',

‎apps/editor/src/views/settings/types/messages.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export interface GetCopyPathsFormatMessage {
208208

209209
export interface UpdateCopyPathsFormatMessage {
210210
command: 'UPDATE_COPY_PATHS_FORMAT'
211-
value: 'list' | 'tree'
211+
value: 'bullet-list' | 'comma-separated' | 'ascii-tree'
212212
}
213213

214214
export interface GetAutoRunIntelligentUpdateMessage {
@@ -484,7 +484,7 @@ export interface ClearChecksInWorkspaceBehaviorMessage {
484484

485485
export interface CopyPathsFormatMessage {
486486
command: 'COPY_PATHS_FORMAT'
487-
value: 'list' | 'tree'
487+
value: 'bullet-list' | 'comma-separated' | 'ascii-tree'
488488
}
489489

490490
export interface ShowSectionMessage {

0 commit comments

Comments
 (0)