Skip to content

Commit ddfaba2

Browse files
committed
Rename compact-file utilities to shrink-file and add user-facing toggle to enable source code shrinking
- in "find relevant files" prompt type, above the prompt field place a checkbox 'shrink source code' with label "Remove functon bodies and comments". Keep state in `apps/editor/src/constants/state-keys.ts` - when "shrink source code" changes, toggle the compact mode - respect the find-relevant-files-shrink-source-code in handlers - rename 'compact' to 'shrink'
1 parent 380c7b6 commit ddfaba2

32 files changed

Lines changed: 354 additions & 192 deletions

‎apps/editor/src/constants/state-keys.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export const HISTORY_CODE_AT_CURSOR_STATE_KEY = 'history-code-at-cursor'
5252
export const HISTORY_FIND_RELEVANT_FILES_STATE_KEY =
5353
'history-find-relevant-files'
5454
export const HISTORY_NO_CONTEXT_STATE_KEY = 'history-no-context'
55+
export const FIND_RELEVANT_FILES_SHRINK_SOURCE_CODE_STATE_KEY =
56+
'find-relevant-files-shrink-source-code'
5557

5658
export const RECENTLY_USED_CODE_AT_CURSOR_CONFIG_IDS_STATE_KEY =
5759
'recently-used-code-at-cursor-config-ids'

‎apps/editor/src/context/providers/open-editors/open-editors-provider.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export class OpenEditorsProvider
2929
private _shared_state: SharedFileState
3030
private _config_change_handler: vscode.Disposable
3131
private _workspace_provider: WorkspaceProvider
32-
private _use_compact_token_count: boolean = false
32+
private _use_shrink_token_count: boolean = false
3333

34-
public set_use_compact_token_count(use_compact: boolean) {
35-
if (this._use_compact_token_count != use_compact) {
36-
this._use_compact_token_count = use_compact
34+
public set_use_shrink_token_count(use_shrink: boolean) {
35+
if (this._use_shrink_token_count != use_shrink) {
36+
this._use_shrink_token_count = use_shrink
3737
this.refresh()
3838
}
3939
}
@@ -202,8 +202,8 @@ export class OpenEditorsProvider
202202

203203
element.checkboxState = checkbox_state
204204

205-
const token_count = this._use_compact_token_count
206-
? element.compactTokenCount
205+
const token_count = this._use_shrink_token_count
206+
? element.shrinkTokenCount
207207
: element.tokenCount
208208

209209
let final_description = element.description || ''
@@ -320,7 +320,7 @@ export class OpenEditorsProvider
320320
false,
321321
true,
322322
tokens.total,
323-
tokens.compact,
323+
tokens.shrink,
324324
undefined,
325325
undefined,
326326
description,

0 commit comments

Comments
 (0)