Skip to content

Commit 7b725d6

Browse files
committed
Convert function declarations to arrow functions for consistency across the codebase
1 parent 629f565 commit 7b725d6

33 files changed

Lines changed: 75 additions & 69 deletions

packages/browser/src/background/keep-alive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import browser from 'webextension-polyfill'
22

3-
export function setup_keep_alive() {
3+
export const setup_keep_alive = () => {
44
if (!browser.browserAction) {
55
const create_keep_alive_alarm = async () => {
66
try {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Message } from '@/types/messages'
22

3-
export function is_message(obj: any): obj is Message {
3+
export const is_message = (obj: any): obj is Message => {
44
return obj && typeof obj.action == 'string'
55
}

packages/vscode/src/commands/apply-chat-response-command/apply-chat-response-command.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,9 @@ export const apply_chat_response_command = (params: {
377377
)
378378
}
379379

380-
async function restore_tab_groups(saved_state: SavedTabGroups): Promise<void> {
380+
const restore_tab_groups = async (
381+
saved_state: SavedTabGroups
382+
): Promise<void> => {
381383
try {
382384
const current_editors: SavedEditorState[] = []
383385
for (const tab_group of vscode.window.tabGroups.all) {

packages/vscode/src/commands/apply-chat-response-command/handlers/conflict-markers-handler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export const handle_conflict_markers = async (
266266
}
267267
}
268268

269-
function parse_conflict_segments(content: string): Segment[] {
269+
const parse_conflict_segments = (content: string): Segment[] => {
270270
const lines = content.split('\n')
271271
const segments: Segment[] = []
272272
let current_lines: string[] = []
@@ -345,10 +345,10 @@ function parse_conflict_segments(content: string): Segment[] {
345345
return segments
346346
}
347347

348-
function apply_conflict_markers_to_content(
348+
const apply_conflict_markers_to_content = (
349349
original_content: string,
350350
markers_content: string
351-
): string {
351+
): string => {
352352
let current_content = original_content
353353
const segments = parse_conflict_segments(markers_content)
354354
let cursor = 0

packages/vscode/src/commands/apply-chat-response-command/handlers/diff-handler.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ export const extract_content_from_patch = (
165165
}
166166
}
167167

168-
async function close_files_in_all_editor_groups(
168+
const close_files_in_all_editor_groups = async (
169169
file_paths: string[],
170170
workspace_path: string
171-
): Promise<vscode.Uri[]> {
171+
): Promise<vscode.Uri[]> => {
172172
const closed_files: vscode.Uri[] = []
173173
const files_to_close = new Set<string>()
174174

@@ -207,7 +207,9 @@ async function close_files_in_all_editor_groups(
207207
return [...new Map(closed_files.map((item) => [item.fsPath, item])).values()]
208208
}
209209

210-
async function reopen_closed_files(closed_files: vscode.Uri[]): Promise<void> {
210+
const reopen_closed_files = async (
211+
closed_files: vscode.Uri[]
212+
): Promise<void> => {
211213
for (const uri of closed_files) {
212214
try {
213215
const document = await vscode.workspace.openTextDocument(uri)
@@ -222,10 +224,10 @@ async function reopen_closed_files(closed_files: vscode.Uri[]): Promise<void> {
222224
}
223225
}
224226

225-
async function process_modified_files(
227+
const process_modified_files = async (
226228
file_paths: string[],
227229
workspace_path: string
228-
): Promise<void> {
230+
): Promise<void> => {
229231
for (const file_path of file_paths) {
230232
const safe_path = create_safe_path(workspace_path, file_path)
231233
if (!safe_path) {

packages/vscode/src/commands/apply-chat-response-command/handlers/fast-replace-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export const handle_fast_replace = async (
350350
}
351351
}
352352

353-
async function close_file_tabs(file_path: string) {
353+
const close_file_tabs = async (file_path: string) => {
354354
const tabs_to_close: vscode.Tab[] = []
355355
for (const tab_group of vscode.window.tabGroups.all) {
356356
tabs_to_close.push(

packages/vscode/src/commands/apply-chat-response-command/handlers/truncated-handler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ export const handle_truncated_edit = async (
125125
return { success: true, original_states, failed_files }
126126
}
127127

128-
function process_truncated_content(
128+
const process_truncated_content = (
129129
new_text: string,
130130
original_text: string
131-
): string {
131+
): string => {
132132
const new_lines = new_text.split(/\r?\n/)
133133
const original_lines = original_text.split(/\r?\n/)
134134

@@ -242,11 +242,11 @@ function process_truncated_content(
242242
return result
243243
}
244244

245-
function find_line_sequence(
245+
const find_line_sequence = (
246246
lines: string[],
247247
sequence: string[],
248248
start_idx: number
249-
): number {
249+
): number => {
250250
if (sequence.length == 0) return -1
251251
if (start_idx >= lines.length) return -1
252252

packages/vscode/src/commands/apply-chat-response-command/response-processor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,11 @@ export const process_chat_response = async (
613613
}
614614
}
615615

616-
function create_failed_file_state(
616+
const create_failed_file_state = (
617617
file: FileItem,
618618
default_workspace: string,
619619
workspace_map: Map<string, string>
620-
): OriginalFileState {
620+
): OriginalFileState => {
621621
let workspace_root = default_workspace
622622
if (file.workspace_name && workspace_map.has(file.workspace_name)) {
623623
workspace_root = workspace_map.get(file.workspace_name)!

packages/vscode/src/commands/apply-chat-response-command/utils/file-operations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Logger } from '@shared/utils/logger'
66
import { OriginalFileState } from '@/commands/apply-chat-response-command/types/original-file-state'
77

88
// Helper to replace fs.existsSync with a non-throwing async version
9-
async function uri_exists(uri: vscode.Uri): Promise<boolean> {
9+
const uri_exists = async (uri: vscode.Uri): Promise<boolean> => {
1010
try {
1111
await vscode.workspace.fs.stat(uri)
1212
return true

packages/vscode/src/commands/checkpoints-command/utils/sync-directory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import * as vscode from 'vscode'
22
import * as path from 'path'
33
import { WorkspaceProvider } from '@/context/providers/workspace/workspace-provider'
44

5-
async function count_sync_operations(params: {
5+
const count_sync_operations = async (params: {
66
source_dir: vscode.Uri
77
dest_dir: vscode.Uri
88
root_path: string
99
workspace_provider: WorkspaceProvider
10-
}): Promise<number> {
10+
}): Promise<number> => {
1111
let count = 0
1212

1313
try {

0 commit comments

Comments
 (0)