Skip to content

Commit 36d7d8c

Browse files
committed
Update directory selection indicators and descriptions in workspace view
- revert change regarding checkbox 'checked' state of a parent [Commit] - on parent folders that are partially selected, add ◐ before X of Y - show '●' also on fully selected - don't show [Pasted text] on files but only on folders - change 'X of Y' to 'Y • X selected' - palce ○ on not selected folders - don't show this tooltip └── apps └── editor └── src ├── context │ ├── context-initialization.ts │ ├── helpers │ │ ├── get-all-workspace-files.ts │ │ └── get-selected-files.ts │ ├── providers │ │ ├── open-editors │ │ │ └── open-editors-provider.ts │ │ ├── selected-files │ │ │ └── selected-files-provider.ts │ │ └── workspace │ │ ├── modules │ │ │ ├── index.ts │ │ │ └── token-calculator.ts │ │ └── workspace-provider.ts │ ├── shared-context-state.ts │ └── utils │ └── shrink-file │ ├── index.ts │ ├── languages │ │ ├── c-style.ts │ │ ├── css.ts │ │ ├── html.ts │ │ ├── jsx.ts │ │ ├── python.ts │ │ ├── ruby.ts │ │ └── sql.ts │ ├── shrink-file.spec.ts │ ├── shrink-file.ts │ └── test-cases │ ├── c-style │ │ ├── input.txt │ │ └── output.txt │ ├── css │ │ ├── input.txt │ │ └── output.txt │ ├── html │ │ ├── input.txt │ │ └── output.txt │ ├── jsx │ │ ├── input.txt │ │ └── output.txt │ ├── python │ │ ├── input.txt │ │ └── output.txt │ ├── ruby │ │ ├── input.txt │ │ └── output.txt │ ├── scss │ │ ├── input.txt │ │ └── output.txt │ └── sql │ ├── input.txt │ └── output.txt └── i18n └── translations └── context.ts
1 parent 1a16589 commit 36d7d8c

2 files changed

Lines changed: 10 additions & 75 deletions

File tree

‎apps/editor/src/context/providers/workspace/workspace-provider.ts‎

Lines changed: 10 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,6 @@ export class WorkspaceProvider
516516
let checkbox_state: vscode.TreeItemCheckboxState | undefined =
517517
this._checked_items.get(key) ?? vscode.TreeItemCheckboxState.Unchecked
518518

519-
const is_selected_files_view =
520-
element.contextValue?.startsWith('context') ?? false
521-
if (
522-
!is_selected_files_view &&
523-
element.isDirectory &&
524-
this._partially_checked_dirs.has(key)
525-
) {
526-
checkbox_state = vscode.TreeItemCheckboxState.Checked
527-
}
528-
529519
if (element.isDirectory) {
530520
const tokens =
531521
await this._token_calculator.calculate_directory_tokens(key)
@@ -551,12 +541,20 @@ export class WorkspaceProvider
551541

552542
let display_description = ''
553543

544+
const is_fully_selected =
545+
element.checkboxState === vscode.TreeItemCheckboxState.Checked ||
546+
(element.isDirectory &&
547+
formatted_selected &&
548+
selected_token_count === total_token_count)
549+
554550
if (element.isDirectory) {
555551
if (formatted_total) {
556552
if (formatted_selected && selected_token_count! < total_token_count!) {
557-
display_description = `${formatted_selected} ${t('context.of')} ${formatted_total}`
553+
display_description = `◐ ${formatted_total} • ${formatted_selected} ${t('context.selected')}`
554+
} else if (is_fully_selected) {
555+
display_description = `● ${formatted_total}`
558556
} else {
559-
display_description = formatted_total
557+
display_description = `○ ${formatted_total}`
560558
}
561559
}
562560
} else {
@@ -572,39 +570,6 @@ export class WorkspaceProvider
572570
element.description =
573571
trimmed_description == '' ? undefined : trimmed_description
574572

575-
const tooltip_parts = [element.resourceUri.fsPath]
576-
if (formatted_total) {
577-
tooltip_parts.push(`· About ${formatted_total} tokens`)
578-
}
579-
if (element.isDirectory) {
580-
if (
581-
element.checkboxState === vscode.TreeItemCheckboxState.Checked ||
582-
(formatted_selected && selected_token_count === total_token_count)
583-
) {
584-
tooltip_parts.push(`· ${t('context.Selected-fully')}`)
585-
} else if (formatted_selected) {
586-
tooltip_parts.push(`· ${formatted_selected} ${t('context.selected')}`)
587-
}
588-
}
589-
590-
element.tooltip = tooltip_parts.join(' ')
591-
592-
if (element.isWorkspaceRoot) {
593-
let root_tooltip = `${element.label} (Workspace Root)`
594-
if (formatted_total) {
595-
root_tooltip += ` • About ${formatted_total} tokens`
596-
if (
597-
element.checkboxState === vscode.TreeItemCheckboxState.Checked ||
598-
(formatted_selected && selected_token_count === total_token_count)
599-
) {
600-
root_tooltip += ` (${t('context.Selected-fully')})`
601-
} else if (formatted_selected) {
602-
root_tooltip += ` (${formatted_selected} ${t('context.selected')})`
603-
}
604-
}
605-
element.tooltip = root_tooltip
606-
}
607-
608573
return element
609574
}
610575

@@ -732,10 +697,6 @@ export class WorkspaceProvider
732697
let checkbox_state: vscode.TreeItemCheckboxState | undefined =
733698
this._checked_items.get(root) ?? vscode.TreeItemCheckboxState.Unchecked
734699

735-
if (!is_selected_files_view && this._partially_checked_dirs.has(root)) {
736-
checkbox_state = vscode.TreeItemCheckboxState.Checked
737-
}
738-
739700
if (total_tokens.file_count === 0) {
740701
checkbox_state = undefined
741702
}
@@ -981,14 +942,6 @@ export class WorkspaceProvider
981942
let final_checkbox_state: vscode.TreeItemCheckboxState | undefined =
982943
checkbox_state
983944

984-
if (
985-
is_directory &&
986-
!is_selected_files_view &&
987-
this._partially_checked_dirs.has(full_path)
988-
) {
989-
final_checkbox_state = vscode.TreeItemCheckboxState.Checked
990-
}
991-
992945
if (is_directory && (tokens as any).file_count === 0) {
993946
final_checkbox_state = undefined
994947
}

‎apps/editor/src/i18n/translations/context.ts‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,5 @@ export const translations = {
7070
cs: 'vybráno',
7171
hu: 'kiválasztva',
7272
bg: 'избрано'
73-
},
74-
'context.of': {
75-
en: 'of',
76-
pl: 'z',
77-
'zh-cn': '/',
78-
ja: '/',
79-
'zh-tw': '/',
80-
de: 'von',
81-
es: 'de',
82-
fr: 'sur',
83-
'pt-br': 'de',
84-
ru: 'из',
85-
ko: '/',
86-
it: 'di',
87-
tr: '/',
88-
cs: 'z',
89-
hu: '/',
90-
bg: 'от'
9173
}
9274
} as const

0 commit comments

Comments
 (0)