Skip to content

Commit a5128de

Browse files
committed
Remove the without-files prompt mode and related configuration, types, history, and UI support
- remove 'without files' prompt type - remove 'no context' mode ├── apps │ └── editor │ ├── package.json │ └── src │ ├── constants │ │ └── state-keys.ts │ ├── 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 │ ├── extension.ts │ ├── utils │ │ └── files-collector.ts │ └── views │ ├── prompt │ │ ├── backend │ │ │ ├── message-handlers │ │ │ │ ├── handle-autofill.ts │ │ │ │ ├── handle-copy-prompt.ts │ │ │ │ ├── handle-get-history.ts │ │ │ │ ├── handle-get-instructions.ts │ │ │ │ ├── handle-get-token-count.ts │ │ │ │ ├── handle-preview-web-configuration.ts │ │ │ │ ├── handle-save-history.ts │ │ │ │ ├── handle-save-instructions.ts │ │ │ │ └── handle-template-quick-pick.ts │ │ │ └── prompt-view-provider.ts │ │ ├── frontend │ │ │ ├── Main │ │ │ │ ├── Main.tsx │ │ │ │ └── MainView │ │ │ │ ├── MainView.tsx │ │ │ │ └── prompt-type-labels.ts │ │ │ ├── Prompt.tsx │ │ │ └── hooks │ │ │ └── use-prompt │ │ │ ├── hooks │ │ │ │ └── use-instructions.ts │ │ │ └── use-prompt.ts │ │ └── types │ │ └── messages.ts │ └── settings │ ├── backend │ │ └── message-handlers │ │ └── handle-get-templates.ts │ └── frontend │ ├── Home │ │ └── sections │ │ └── GeneralSection.tsx │ └── i18n │ └── translations │ └── general.ts └── packages └── shared └── src └── types └── prompt-types.ts
1 parent 5e1aa2e commit a5128de

27 files changed

Lines changed: 45 additions & 245 deletions

‎apps/editor/package.json‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,24 +1133,6 @@
11331133
]
11341134
}
11351135
},
1136-
"codeWebChat.templatesForWithoutFiles": {
1137-
"type": "array",
1138-
"scope": "resource",
1139-
"items": {
1140-
"type": "object",
1141-
"properties": {
1142-
"name": {
1143-
"type": "string"
1144-
},
1145-
"template": {
1146-
"type": "string"
1147-
}
1148-
},
1149-
"required": [
1150-
"template"
1151-
]
1152-
}
1153-
},
11541136
"codeWebChat.modelProviders": {
11551137
"type": "array",
11561138
"scope": "resource",

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export const PROMPT_VIEW_MODE_STATE_KEY = 'prompt-view-mode'
4343

4444
export const INSTRUCTIONS_EDIT_FILES_STATE_KEY = 'instructions-edit-files'
4545
export const INSTRUCTIONS_ASK_STATE_KEY = 'instructions-ask'
46-
export const INSTRUCTIONS_NO_CONTEXT_STATE_KEY = 'instructions-no-context'
4746
export const INSTRUCTIONS_CODE_AT_CURSOR_STATE_KEY =
4847
'instructions-code-at-cursor'
4948

@@ -52,7 +51,6 @@ export const ARE_CHECKPOINTS_COLLAPSED_STATE_KEY = 'are-checkpoints-collapsed'
5251

5352
export const HISTORY_ASK_ABOUT_FILES_STATE_KEY = 'history-ask-about-files'
5453
export const HISTORY_EDIT_FILES_STATE_KEY = 'history-edit-files'
55-
export const HISTORY_WITHOUT_FILES_STATE_KEY = 'history-without-files'
5654

5755
export const INTELLIGENT_FILE_SEARCH_SHRINK_SOURCE_CODE_STATE_KEY =
5856
'intelligent-file-search-shrink-source-code'

‎apps/editor/src/context/context-initialization.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,10 @@ export const context_initialization = async (
126126
const update_view_badges = async () => {
127127
let context_token_count = 0
128128
if (selected_files_provider && selected_files_view) {
129-
if (!workspace_provider.is_no_context_mode) {
130-
const token_counts =
131-
await workspace_provider.get_checked_files_token_count()
132-
const files_count = token_counts.total
133-
context_token_count = files_count
134-
}
129+
const token_counts =
130+
await workspace_provider.get_checked_files_token_count()
131+
const files_count = token_counts.total
132+
context_token_count = files_count
135133

136134
workspace_view.badge = {
137135
value: round_token_count_for_badge(context_token_count),

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

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ export class OpenEditorsProvider
2929
private _shared_context_state: SharedContextState
3030
private _config_change_handler: vscode.Disposable
3131
private _workspace_provider: WorkspaceProvider
32-
private _is_no_context_mode = false
33-
34-
public set_no_context_mode(is_no_context: boolean) {
35-
if (this._is_no_context_mode == is_no_context) return
36-
this._is_no_context_mode = is_no_context
37-
this.refresh()
38-
}
3932

4033
constructor(params: {
4134
workspace_folders: readonly vscode.WorkspaceFolder[]
@@ -210,11 +203,9 @@ export class OpenEditorsProvider
210203
getTreeItem(element: FileItem): vscode.TreeItem {
211204
const key = element.resourceUri.fsPath
212205
const is_ignored = this._is_file_ignored(key)
213-
const checkbox_state =
214-
this._is_no_context_mode || is_ignored
215-
? undefined
216-
: (this._checked_items.get(key) ??
217-
vscode.TreeItemCheckboxState.Unchecked)
206+
const checkbox_state = is_ignored
207+
? undefined
208+
: (this._checked_items.get(key) ?? vscode.TreeItemCheckboxState.Unchecked)
218209

219210
element.checkboxState = checkbox_state
220211

@@ -328,7 +319,7 @@ export class OpenEditorsProvider
328319
file_uri,
329320
vscode.TreeItemCollapsibleState.None,
330321
false,
331-
this._is_no_context_mode || is_ignored ? undefined : checkbox_state,
322+
is_ignored ? undefined : checkbox_state,
332323
false,
333324
true,
334325
tokens?.total,

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

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export interface IWorkspaceProvider {
3131
checked_files: string[]
3232
checked_timestamps: Record<string, number>
3333
}
34-
readonly is_no_context_mode: boolean
3534
get_all_files_for_uri(uri: vscode.Uri): Promise<vscode.Uri[]>
3635
}
3736

@@ -54,11 +53,6 @@ export class WorkspaceProvider
5453
private _checked_items = new Map<string, vscode.TreeItemCheckboxState>()
5554
private _checked_timestamps = new Map<string, number>()
5655
private _partially_checked_dirs = new Set<string>()
57-
private _is_no_context_mode: boolean = false
58-
59-
public get is_no_context_mode(): boolean {
60-
return this._is_no_context_mode
61-
}
6256

6357
private _combined_gitignore = ignore()
6458
private _user_ignore_patterns: Ignore = ignore()
@@ -96,12 +90,6 @@ export class WorkspaceProvider
9690
this._workspace_view_collapsible_state = state
9791
}
9892

99-
public set_no_context_mode(is_no_context: boolean) {
100-
if (this._is_no_context_mode == is_no_context) return
101-
this._is_no_context_mode = is_no_context
102-
this.refresh()
103-
}
104-
10593
constructor(params: {
10694
workspace_folders: readonly vscode.WorkspaceFolder[]
10795
extension_context: vscode.ExtensionContext
@@ -583,9 +571,8 @@ export class WorkspaceProvider
583571

584572
async getTreeItem(element: FileItem): Promise<vscode.TreeItem> {
585573
const key = element.resourceUri.fsPath
586-
const checkbox_state = this._is_no_context_mode
587-
? undefined
588-
: (this._checked_items.get(key) ?? vscode.TreeItemCheckboxState.Unchecked)
574+
const checkbox_state =
575+
this._checked_items.get(key) ?? vscode.TreeItemCheckboxState.Unchecked
589576

590577
element.checkboxState = checkbox_state
591578

@@ -598,9 +585,7 @@ export class WorkspaceProvider
598585
: undefined
599586

600587
const formatted_selected =
601-
selected_token_count !== undefined &&
602-
selected_token_count > 0 &&
603-
!this._is_no_context_mode
588+
selected_token_count !== undefined && selected_token_count > 0
604589
? display_token_count(selected_token_count)
605590
: undefined
606591

@@ -711,10 +696,6 @@ export class WorkspaceProvider
711696
await this.gitignore_initialization
712697
await this.ranges_initialization
713698

714-
if (this._is_no_context_mode) {
715-
return []
716-
}
717-
718699
if (element) {
719700
const dir_path = element.resourceUri.fsPath
720701
if (element.isDirectory) {
@@ -791,10 +772,8 @@ export class WorkspaceProvider
791772
? this._selected_files_view_collapsible_state
792773
: this._workspace_view_collapsible_state,
793774
true,
794-
this._is_no_context_mode
795-
? undefined
796-
: (this._checked_items.get(root) ??
797-
vscode.TreeItemCheckboxState.Unchecked),
775+
this._checked_items.get(root) ??
776+
vscode.TreeItemCheckboxState.Unchecked,
798777
false,
799778
false,
800779
total_tokens.total,
@@ -1031,7 +1010,7 @@ export class WorkspaceProvider
10311010
: this._workspace_view_collapsible_state
10321011
: vscode.TreeItemCollapsibleState.None,
10331012
is_directory,
1034-
this._is_no_context_mode ? undefined : checkbox_state,
1013+
checkbox_state,
10351014
false,
10361015
false,
10371016
tokens.total,

‎apps/editor/src/utils/files-collector.ts‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export namespace FilesCollector {
1212
workspace_provider: WorkspaceProvider
1313
open_editors_provider?: OpenEditorsProvider
1414
additional_paths?: string[]
15-
no_context?: boolean
1615
shrink?: boolean
1716
}): Promise<{ other_files: string; recent_files: string }> => {
1817
const workspace_roots = params.workspace_provider.get_workspace_roots()
@@ -25,18 +24,14 @@ export namespace FilesCollector {
2524

2625
const context_files_list: string[] = []
2726

28-
if (params.no_context) {
29-
context_files_list.push(...additional_paths)
30-
} else {
31-
const workspace_files = params.workspace_provider.get_checked_files()
32-
const open_editor_files =
33-
params.open_editors_provider?.get_checked_files() || []
34-
context_files_list.push(
35-
...workspace_files,
36-
...open_editor_files,
37-
...additional_paths
38-
)
39-
}
27+
const workspace_files = params.workspace_provider.get_checked_files()
28+
const open_editor_files =
29+
params.open_editors_provider?.get_checked_files() || []
30+
context_files_list.push(
31+
...workspace_files,
32+
...open_editor_files,
33+
...additional_paths
34+
)
4035

4136
const context_files = [...new Set(context_files_list)]
4237

‎apps/editor/src/views/prompt/backend/message-handlers/handle-autofill.ts‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ export const handle_autofill = async (params: {
6464
const collected = await FilesCollector.collect_files({
6565
workspace_provider: params.prompt_view_provider.workspace_provider,
6666
open_editors_provider: params.prompt_view_provider.open_editors_provider,
67-
additional_paths,
68-
no_context: params.prompt_view_provider.web_prompt_type == 'without-files'
67+
additional_paths
6968
})
7069
const context_text = collected.other_files + collected.recent_files
7170

@@ -239,11 +238,6 @@ const resolve_web_configuration = async (params: {
239238
params.prompt_view_provider.edit_files_instructions.instructions[
240239
params.prompt_view_provider.edit_files_instructions.active_index
241240
] || ''
242-
} else if (params.prompt_view_provider.web_prompt_type == 'without-files') {
243-
current_instructions =
244-
params.prompt_view_provider.no_context_instructions.instructions[
245-
params.prompt_view_provider.no_context_instructions.active_index
246-
] || ''
247241
}
248242

249243
const get_is_web_configuration_disabled = (

‎apps/editor/src/views/prompt/backend/message-handlers/handle-copy-prompt.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ export const handle_copy_prompt = async (params: {
1818
}): Promise<void> => {
1919
const collected = await FilesCollector.collect_files({
2020
workspace_provider: params.prompt_view_provider.workspace_provider,
21-
open_editors_provider: params.prompt_view_provider.open_editors_provider,
22-
no_context: params.prompt_view_provider.prompt_type == 'without-files'
21+
open_editors_provider: params.prompt_view_provider.open_editors_provider
2322
})
2423
const context_text = collected.other_files + collected.recent_files
2524

‎apps/editor/src/views/prompt/backend/message-handlers/handle-get-history.ts‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
HISTORY_ASK_ABOUT_FILES_STATE_KEY,
33
HISTORY_EDIT_FILES_STATE_KEY,
4-
HISTORY_WITHOUT_FILES_STATE_KEY,
54
HistoryEntry
65
} from '@/constants/state-keys'
76
import { PromptViewProvider } from '@/views/prompt/backend/prompt-view-provider'
@@ -19,16 +18,9 @@ export const handle_get_history = (
1918
HISTORY_ASK_ABOUT_FILES_STATE_KEY,
2019
[]
2120
)
22-
const without_files_history =
23-
prompt_view_provider.extension_context.workspaceState.get<HistoryEntry[]>(
24-
HISTORY_WITHOUT_FILES_STATE_KEY,
25-
[]
26-
)
27-
2821
prompt_view_provider.send_message({
2922
command: 'CHAT_HISTORY',
3023
ask_about_files: ask_about_files_history.map((h) => h.text),
31-
edit_files: edit_files_history.map((h) => h.text),
32-
without_files: without_files_history.map((h) => h.text)
24+
edit_files: edit_files_history.map((h) => h.text)
3325
})
3426
}

‎apps/editor/src/views/prompt/backend/message-handlers/handle-get-instructions.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const handle_get_instructions = (
66
prompt_view_provider.send_message({
77
command: 'INSTRUCTIONS',
88
ask_about_context: prompt_view_provider.ask_about_context_instructions,
9-
edit_files: prompt_view_provider.edit_files_instructions,
10-
no_context: prompt_view_provider.no_context_instructions
9+
edit_files: prompt_view_provider.edit_files_instructions
1110
})
1211
}

0 commit comments

Comments
 (0)