Skip to content

Commit d59d6b0

Browse files
committed
Replace strict equality checks with loose equality operators throughout the codebase and refactor file search implementation to use glob patterns
1 parent 5a0b5a8 commit d59d6b0

18 files changed

Lines changed: 28 additions & 27 deletions

File tree

‎apps/editor/src/commands/apply-chat-response-command/utils/edit-formats/diffs/test-cases/generic-4/diff.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
- const term = keywords_input.trim().toLowerCase()
1212
+ const term = keywords_input.trim()
13-
if (term.length === 0) return
13+
if (term.length == 0) return
1414

1515
- const keywords = [[term]]
1616
-

‎apps/editor/src/commands/apply-chat-response-command/utils/edit-formats/diffs/test-cases/generic-4/expected.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const search_files_for_context_command = (
8686
initial_keywords = keywords_input
8787

8888
const term = keywords_input.trim()
89-
if (term.length === 0) return
89+
if (term.length == 0) return
9090

9191
// If the user input contains a wildcard, treat it as a glob.
9292
// Otherwise, wrap it to search for any file containing the term.

‎apps/editor/src/commands/apply-chat-response-command/utils/edit-formats/diffs/test-cases/generic-4/original.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const search_files_for_context_command = (
8787
initial_keywords = keywords_input
8888

8989
const term = keywords_input.trim().toLowerCase()
90-
if (term.length === 0) return
90+
if (term.length == 0) return
9191

9292
const keywords = [[term]]
9393

‎apps/editor/src/commands/apply-chat-response-command/utils/edit-formats/truncations/process-truncation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const find_line_sequence = (
124124
sequence: string[],
125125
start_idx: number
126126
): number => {
127-
if (sequence.length === 0) return -1
127+
if (sequence.length == 0) return -1
128128
if (start_idx >= lines.length) return -1
129129

130130
for (let i = start_idx; i <= lines.length - sequence.length; i++) {

‎apps/editor/src/commands/check-definition-file-for-context-command.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const check_definition_file_for_context_command = (
3131
if (!result) return null
3232

3333
if (Array.isArray(result)) {
34-
if (result.length === 0) return null
34+
if (result.length == 0) return null
3535
const first = result[0]
3636
return 'targetUri' in first ? first.targetUri : first.uri
3737
} else {

‎apps/editor/src/commands/check-referencing-files-for-context-command.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const check_referencing_files_for_context_command = (
5151
}
5252
)
5353

54-
if (matched_files.length === 0) {
54+
if (matched_files.length == 0) {
5555
vscode.window.showInformationMessage(
5656
t('command.context.check-references.no-files')
5757
)
@@ -164,7 +164,7 @@ export const check_referencing_files_for_context_command = (
164164
quick_pick.show()
165165
})
166166

167-
if (!selected_items || selected_items.length == 0) {
167+
if (!selected_items) {
168168
return
169169
}
170170

@@ -176,11 +176,12 @@ export const check_referencing_files_for_context_command = (
176176
.map((m) => m.file_path)
177177
.filter((file_path) => !selected_paths_set.has(file_path))
178178
)
179-
const currently_checked_filtered = currently_checked.filter(
179+
const latest_checked = workspace_provider.get_checked_files()
180+
const latest_checked_filtered = latest_checked.filter(
180181
(file) => !unselected_files_set.has(file)
181182
)
182183
const paths_to_apply = [
183-
...new Set([...currently_checked_filtered, ...selected_paths])
184+
...new Set([...latest_checked_filtered, ...selected_paths])
184185
]
185186

186187
Logger.info({

‎apps/editor/src/commands/find-relevant-files-command/find-relevant-files-command.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const find_relevant_files_command = (
7878
)
7979
const configs = await api_providers_manager.get_tool_configs()
8080

81-
if (configs.length === 0) {
81+
if (configs.length == 0) {
8282
vscode.commands.executeCommand('codeWebChat.settings')
8383
vscode.window.showInformationMessage(
8484
t('command.find-relevant-files.error.no-configs')

‎apps/editor/src/commands/find-relevant-files-command/utils/fetch-relevant-files-from-api.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const fetch_relevant_files_from_api = async (
8686
const file_matches = match[1].matchAll(/<file-path>(.*?)<\/file-path>/g)
8787
for (const m of file_matches) extracted_files.push(m[1].trim())
8888
}
89-
return extracted_files.length === 0 ? 'error_no_files' : extracted_files
89+
return extracted_files.length == 0 ? 'error_no_files' : extracted_files
9090
}
9191
return 'cancel'
9292
} catch (error) {

‎apps/editor/src/commands/search-files-for-context-command/search-files-for-context-commands.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const search_files_for_context_commands = (
5959
initial_search_term = search_term_input
6060

6161
const search_term = search_term_input.trim()
62-
if (search_term.length === 0) return
62+
if (search_term.length == 0) return
6363

6464
let all_files: string[] = []
6565

@@ -78,7 +78,7 @@ export const search_files_for_context_commands = (
7878
search_term
7979
})
8080

81-
if (matched_files.length === 0) {
81+
if (matched_files.length == 0) {
8282
vscode.window.showInformationMessage(t('command.search.no-files'))
8383
continue
8484
}
@@ -89,11 +89,11 @@ export const search_files_for_context_commands = (
8989
workspace_provider
9090
})
9191

92-
if (selected_items === 'back') {
92+
if (selected_items == 'back') {
9393
continue
9494
}
9595

96-
if (!selected_items || selected_items.length === 0) {
96+
if (!selected_items) {
9797
return
9898
}
9999

‎apps/editor/src/commands/search-files-for-context-command/utils/prompt-for-search-term.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const prompt_for_search_term = async (
2929
}),
3030
input_box.onDidAccept(() => {
3131
const value = input_box.value.trim()
32-
if (value.length === 0) {
32+
if (value.length == 0) {
3333
input_box.validationMessage = t('command.search.validation-empty')
3434
return
3535
}

0 commit comments

Comments
 (0)