Skip to content

Commit 990deb5

Browse files
committed
Convert all internal function definitions to use arrow function syntax for consistency
1 parent a49cb8a commit 990deb5

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

‎packages/vscode/src/commands/checkpoints-command.ts‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ interface Checkpoint {
1212
is_temporary?: boolean
1313
}
1414

15-
function get_checkpoint_path(timestamp: number): string {
15+
const get_checkpoint_path = (timestamp: number): string => {
1616
const checkpoint_dir_name = `cwc-checkpoint-${timestamp}`
1717
return path.join(os.tmpdir(), checkpoint_dir_name)
1818
}
1919

20-
async function get_checkpoints(
20+
const get_checkpoints = async (
2121
context: vscode.ExtensionContext
22-
): Promise<Checkpoint[]> {
22+
): Promise<Checkpoint[]> => {
2323
const checkpoints =
2424
context.workspaceState.get<Checkpoint[]>(CHECKPOINTS_STATE_KEY, []) ?? []
2525
const valid_checkpoints: Checkpoint[] = []
@@ -44,11 +44,11 @@ async function get_checkpoints(
4444
return valid_checkpoints.sort((a, b) => b.timestamp - a.timestamp)
4545
}
4646

47-
async function directory_contains_ignored(
47+
const directory_contains_ignored = async (
4848
dir_uri: vscode.Uri,
4949
root_path: string,
5050
workspace_provider: WorkspaceProvider
51-
): Promise<boolean> {
51+
): Promise<boolean> => {
5252
const entries = await vscode.workspace.fs.readDirectory(dir_uri)
5353
for (const [name] of entries) {
5454
const entry_uri = vscode.Uri.joinPath(dir_uri, name)
@@ -90,12 +90,12 @@ async function directory_contains_ignored(
9090
return false
9191
}
9292

93-
async function copy_optimised_recursively(
93+
const copy_optimised_recursively = async (
9494
source_uri: vscode.Uri,
9595
dest_uri: vscode.Uri,
9696
root_path: string,
9797
workspace_provider: WorkspaceProvider
98-
) {
98+
) => {
9999
const relative_path = path.relative(root_path, source_uri.fsPath)
100100
if (relative_path && workspace_provider.is_excluded(relative_path)) {
101101
return
@@ -148,10 +148,10 @@ async function copy_optimised_recursively(
148148
// Other file types are ignored. fs.stat resolves symlinks.
149149
}
150150

151-
async function copy_workspace_to_dir(
151+
const copy_workspace_to_dir = async (
152152
dest_dir_uri: vscode.Uri,
153153
workspace_provider: WorkspaceProvider
154-
) {
154+
) => {
155155
const workspace_folders = vscode.workspace.workspaceFolders!
156156
const dest_dir_path = dest_dir_uri.fsPath
157157

@@ -177,10 +177,10 @@ async function copy_workspace_to_dir(
177177
}
178178
}
179179

180-
async function create_checkpoint(
180+
const create_checkpoint = async (
181181
workspace_provider: WorkspaceProvider,
182182
context: vscode.ExtensionContext
183-
) {
183+
) => {
184184
const name = await vscode.window.showInputBox({
185185
prompt: 'Enter a name for the checkpoint',
186186
value: `Checkpoint @ ${new Date().toLocaleString()}`
@@ -222,10 +222,10 @@ async function create_checkpoint(
222222
}
223223
}
224224

225-
async function create_temporary_checkpoint(
225+
const create_temporary_checkpoint = async (
226226
workspace_provider: WorkspaceProvider,
227227
context: vscode.ExtensionContext
228-
): Promise<Checkpoint> {
228+
): Promise<Checkpoint> => {
229229
const timestamp = Date.now()
230230
const name = `_temp_revert_${timestamp}`
231231
const checkpoint_dir_path = get_checkpoint_path(timestamp)
@@ -246,12 +246,12 @@ async function create_temporary_checkpoint(
246246
return new_checkpoint
247247
}
248248

249-
async function sync_directory(
249+
const sync_directory = async (
250250
source_dir: vscode.Uri,
251251
dest_dir: vscode.Uri,
252252
root_path: string,
253253
workspace_provider: WorkspaceProvider
254-
) {
254+
) => {
255255
let dest_entries: [string, vscode.FileType][]
256256
try {
257257
dest_entries = await vscode.workspace.fs.readDirectory(dest_dir)
@@ -345,11 +345,11 @@ async function sync_directory(
345345
}
346346
}
347347

348-
async function clean_directory(
348+
const clean_directory = async (
349349
dir_uri: vscode.Uri,
350350
root_path: string,
351351
workspace_provider: WorkspaceProvider
352-
) {
352+
) => {
353353
const entries = await vscode.workspace.fs.readDirectory(dir_uri)
354354
for (const [name, type] of entries) {
355355
const entry_uri = vscode.Uri.joinPath(dir_uri, name)
@@ -388,10 +388,10 @@ async function clean_directory(
388388
}
389389
}
390390

391-
async function sync_workspace_from_dir(
391+
const sync_workspace_from_dir = async (
392392
source_dir_uri: vscode.Uri,
393393
workspace_provider: WorkspaceProvider
394-
) {
394+
) => {
395395
const workspace_folders = vscode.workspace.workspaceFolders!
396396

397397
if (workspace_folders.length > 1) {
@@ -426,12 +426,12 @@ async function sync_workspace_from_dir(
426426
}
427427
}
428428

429-
async function restore_checkpoint(
429+
const restore_checkpoint = async (
430430
checkpoint: Checkpoint,
431431
workspace_provider: WorkspaceProvider,
432432
context: vscode.ExtensionContext,
433433
options?: { skip_confirmation?: boolean }
434-
) {
434+
) => {
435435
if (!options?.skip_confirmation) {
436436
const confirmation = await vscode.window.showWarningMessage(
437437
`This will replace all contents of your current workspace with the checkpoint "${checkpoint.name}".`,
@@ -506,11 +506,11 @@ async function restore_checkpoint(
506506
}
507507
}
508508

509-
async function delete_checkpoint(
509+
const delete_checkpoint = async (
510510
context: vscode.ExtensionContext,
511511
checkpoint_to_delete: Checkpoint,
512512
options?: { is_reverting?: boolean }
513-
) {
513+
) => {
514514
if (!options?.is_reverting) {
515515
const confirmation = await vscode.window.showWarningMessage(
516516
`Are you sure you want to delete the checkpoint "${checkpoint_to_delete.name}"? This action cannot be undone.`,
@@ -547,10 +547,10 @@ async function delete_checkpoint(
547547
}
548548
}
549549

550-
export function checkpoints_command(
550+
export const checkpoints_command = (
551551
workspace_provider: WorkspaceProvider,
552552
context: vscode.ExtensionContext
553-
) {
553+
) => {
554554
return vscode.commands.registerCommand(
555555
'codeWebChat.checkpoints',
556556
async () => {

0 commit comments

Comments
 (0)