Skip to content

Commit 0258bb6

Browse files
committed
Refactor search files commands to create and dispose their output channels internally instead of sharing a global one
- don't create output channel in `apps/editor/src/extension.ts`, create and dispose locally in the command, as it can't be run more often than once └── apps └── editor └── src ├── commands │ └── search-files-commands │ ├── index.ts │ ├── search-files-commands.ts │ └── utils │ ├── get-target-folder-path.ts │ └── prompt-for-provided-results.ts ├── extension.ts └── features └── search-files ├── index.ts ├── search-files.ts ├── search-modes │ ├── perform-agent-search-mode │ │ ├── agents │ │ │ ├── antigravity.ts │ │ │ ├── claude.ts │ │ │ ├── codex.ts │ │ │ ├── cursor.ts │ │ │ ├── grok.ts │ │ │ ├── muse.ts │ │ │ └── opencode.ts │ │ ├── index.ts │ │ ├── perform-agent-search-mode.ts │ │ ├── types.ts │ │ └── utils.ts │ ├── perform-intelligent-search-mode.ts │ ├── perform-keywords-search-mode.ts │ └── perform-phrase-search-mode.ts └── utils ├── analyze-files.ts ├── check-matches-condition.ts ├── create-search-regex.ts ├── group-quick-pick-items.ts ├── handle-parent-folder-result.ts ├── map-files-to-quick-pick-items.ts ├── prompt-for-config.ts ├── prompt-for-intelligent-search-results.ts ├── prompt-for-keywords-match-mode.ts ├── prompt-for-keywords-target.ts ├── prompt-for-search-mode.ts ├── prompt-for-search-results.ts ├── prompt-for-search-term.ts ├── prompt-for-shrink-mode.ts ├── search-files-by-intelligent.ts ├── search-files-by-keywords.ts ├── search-files-by-phrase.ts └── show-search-results-quick-pick.ts
1 parent 754ed98 commit 0258bb6

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎apps/editor/src/commands/search-files-commands/search-files-commands.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ let search_in_progress = false
1313
export const search_files_commands = (
1414
workspace_provider: WorkspaceProvider,
1515
extension_context: vscode.ExtensionContext,
16-
websocket_manager: WebSocketManager,
17-
output_channel: vscode.OutputChannel
16+
websocket_manager: WebSocketManager
1817
) => {
1918
const process_search_result = async (params: {
2019
result: {
@@ -124,6 +123,8 @@ export const search_files_commands = (
124123
return
125124
}
126125
search_in_progress = true
126+
const output_channel =
127+
vscode.window.createOutputChannel('CWC Agentic Search')
127128
try {
128129
if (options?.provided_files) {
129130
let resolved_all_files: string[] = []
@@ -258,6 +259,7 @@ export const search_files_commands = (
258259
}
259260
} finally {
260261
search_in_progress = false
262+
output_channel.dispose()
261263
}
262264
}
263265

@@ -269,6 +271,7 @@ export const search_files_commands = (
269271
return
270272
}
271273
search_in_progress = true
274+
const output_channel = vscode.window.createOutputChannel('Code Web Chat')
272275
try {
273276
const currently_checked = workspace_provider.get_checked_files()
274277
if (currently_checked.length === 0) {
@@ -323,6 +326,7 @@ export const search_files_commands = (
323326
}
324327
} finally {
325328
search_in_progress = false
329+
output_channel.dispose()
326330
}
327331
}
328332

‎apps/editor/src/extension.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ export const activate = async (extension_context: vscode.ExtensionContext) => {
8888
extension_context
8989
)
9090

91-
const output_channel = vscode.window.createOutputChannel('Code Web Chat')
92-
extension_context.subscriptions.push(output_channel)
93-
9491
const prompt_view_api_calls_manager = new PromptViewApiCallsManager(
9592
prompt_view_provider,
9693
chats_view_provider
@@ -206,8 +203,7 @@ export const activate = async (extension_context: vscode.ExtensionContext) => {
206203
...search_files_commands(
207204
workspace_provider,
208205
extension_context,
209-
websocket_server_instance,
210-
output_channel
206+
websocket_server_instance
211207
),
212208
select_definition_file_command(workspace_provider),
213209
open_url_command({

0 commit comments

Comments
 (0)