Skip to content

Commit 4c158ff

Browse files
committed
Remove the unused parameter and related logic from and associated message handlers
1 parent be1bfe4 commit 4c158ff

5 files changed

Lines changed: 4 additions & 30 deletions

File tree

‎packages/vscode/src/utils/files-collector.ts‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as fs from 'fs'
22
import * as path from 'path'
3-
import * as vscode from 'vscode'
43
import { WorkspaceProvider } from '../context/providers/workspace-provider'
54
import { OpenEditorsProvider } from '../context/providers/open-editors-provider'
65
import { WebsitesProvider } from '../context/providers/websites-provider'
@@ -28,7 +27,6 @@ export class FilesCollector {
2827
exclude_path?: string
2928
additional_paths?: string[]
3029
no_context?: boolean
31-
include_file_with_text_selection?: boolean
3230
}): Promise<string> {
3331
const additional_paths = (params?.additional_paths ?? []).map((p) => {
3432
if (this.workspace_roots.length > 0) {
@@ -52,13 +50,6 @@ export class FilesCollector {
5250
)
5351
}
5452

55-
if (params?.include_file_with_text_selection) {
56-
const active_editor = vscode.window.activeTextEditor
57-
if (active_editor && !active_editor.selection.isEmpty) {
58-
context_files_list.push(active_editor.document.uri.fsPath)
59-
}
60-
}
61-
6253
const context_files = [...new Set(context_files_list)]
6354
context_files.sort((a, b) => natural_sort(a, b))
6455

‎packages/vscode/src/views/panel/backend/message-handlers/handle-copy-prompt.ts‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,8 @@ export const handle_copy_prompt = async (params: {
7878

7979
vscode.env.clipboard.writeText(text.trim())
8080
} else if (!is_in_code_completions_mode) {
81-
const has_selection =
82-
!!vscode.window.activeTextEditor &&
83-
!vscode.window.activeTextEditor.selection.isEmpty &&
84-
final_instruction.includes('#Selection')
85-
8681
const context_text = await files_collector.collect_files({
87-
no_context: params.provider.web_mode == 'no-context',
88-
include_file_with_text_selection: has_selection
82+
no_context: params.provider.web_mode == 'no-context'
8983
})
9084

9185
if (params.provider.web_mode == 'edit-context' && !context_text) {

‎packages/vscode/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,7 @@ const perform_context_editing = async (params: {
240240
})
241241
}
242242

243-
const collected_files = await files_collector.collect_files({
244-
include_file_with_text_selection: has_selection
245-
})
243+
const collected_files = await files_collector.collect_files()
246244

247245
if (!collected_files) {
248246
vscode.window.showWarningMessage(

‎packages/vscode/src/views/panel/backend/message-handlers/handle-preview-preset.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ export const handle_preview_preset = async (
8484

8585
const context_text =
8686
provider.web_mode != 'no-context'
87-
? await files_collector.collect_files({
88-
include_file_with_text_selection: has_selection
89-
})
87+
? await files_collector.collect_files({})
9088
: ''
9189

9290
if (has_selection) {

‎packages/vscode/src/views/panel/backend/message-handlers/handle-send-prompt.ts‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,11 @@ export const handle_send_prompt = async (params: {
143143
})
144144
} else {
145145
const editor = vscode.window.activeTextEditor
146-
147-
const has_selection =
148-
!!editor &&
149-
!editor.selection.isEmpty &&
150-
current_instructions.includes('#Selection')
151-
152146
const additional_paths: string[] = []
153147

154148
const context_text = await files_collector.collect_files({
155149
additional_paths,
156-
no_context: params.provider.web_mode == 'no-context',
157-
include_file_with_text_selection: has_selection
150+
no_context: params.provider.web_mode == 'no-context'
158151
})
159152

160153
const chats = await Promise.all(

0 commit comments

Comments
 (0)