Skip to content

Commit 39a43cf

Browse files
committed
Standardize extension context parameter naming across modules and update relevant files parser
1 parent 1612d47 commit 39a43cf

10 files changed

Lines changed: 31 additions & 30 deletions

File tree

‎apps/editor/src/commands/apply-response-command/apply-response-command.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export const apply_response_command = (params: {
452452
in_progress = false
453453
if (before_checkpoint) {
454454
delete_checkpoint({
455-
context: params.extension_context,
455+
extension_context: params.extension_context,
456456
panel_provider: params.panel_provider,
457457
checkpoint_to_delete: before_checkpoint
458458
})

‎apps/editor/src/commands/apply-response-command/utils/response-parser/parsers/relevant-files-parser/relevant-files-parser.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const parse_relevant_files = (params: {
1010
workspace_files: string[]
1111
}): RelevantFilesItem | null => {
1212
if (
13+
params.response.includes('### File:') ||
1314
params.response.includes('### Created file:') ||
1415
params.response.includes('### Updated file:') ||
1516
params.response.includes('### Deleted file:') ||

‎apps/editor/src/commands/history-command.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export const history_command = (params: {
275275
undefined
276276
)
277277
await delete_checkpoint({
278-
context: params.extension_context,
278+
extension_context: params.extension_context,
279279
checkpoint_to_delete: temp_checkpoint,
280280
panel_provider: params.panel_provider
281281
})
@@ -340,7 +340,7 @@ export const history_command = (params: {
340340
e.button.tooltip == t('common.unstar')
341341
) {
342342
await toggle_checkpoint_star({
343-
context: params.extension_context,
343+
extension_context: params.extension_context,
344344
timestamp: item.checkpoint.timestamp,
345345
panel_provider: params.panel_provider
346346
})
@@ -396,7 +396,7 @@ export const history_command = (params: {
396396

397397
if (e.button.tooltip == t('common.delete')) {
398398
const was_restored = await delete_checkpoint_with_undo({
399-
context: params.extension_context,
399+
extension_context: params.extension_context,
400400
checkpoint: item.checkpoint,
401401
panel_provider: params.panel_provider,
402402
get_active_operation: () => active_delete_operation,

‎apps/editor/src/context/providers/workspace/modules/token-calculator.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ export class TokenCalculator implements vscode.Disposable {
4141

4242
constructor(
4343
private _provider: IWorkspaceProvider,
44-
private _context: vscode.ExtensionContext
44+
private _extension_context: vscode.ExtensionContext
4545
) {
4646
this._load_token_cache()
4747
}
4848

4949
private async _load_token_cache(): Promise<void> {
5050
try {
51-
const storage_path = this._context.globalStorageUri.fsPath
51+
const storage_path = this._extension_context.globalStorageUri.fsPath
5252
const cache_path = path.join(storage_path, TOKEN_CACHE_FILE_NAME)
5353
const content = await fs.promises.readFile(cache_path, 'utf8')
5454
const raw_cache = JSON.parse(content)
@@ -72,7 +72,7 @@ export class TokenCalculator implements vscode.Disposable {
7272
}
7373

7474
this._token_cache_update_timeout = setTimeout(async () => {
75-
const storage_path = this._context.globalStorageUri.fsPath
75+
const storage_path = this._extension_context.globalStorageUri.fsPath
7676
const cache_path = path.join(storage_path, TOKEN_CACHE_FILE_NAME)
7777
const current_global_cache: TokenCountsCache = {}
7878

‎apps/editor/src/features/checkpoints/actions/delete-checkpoint.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ import { PanelProvider } from '@/views/panel/backend/panel-provider'
77
import { t } from '@/i18n'
88

99
export const delete_checkpoint = async (params: {
10-
context: vscode.ExtensionContext
10+
extension_context: vscode.ExtensionContext
1111
checkpoint_to_delete: Checkpoint
1212
panel_provider: PanelProvider
1313
}) => {
1414
const checkpoints =
15-
params.context.workspaceState.get<Checkpoint[]>(
15+
params.extension_context.workspaceState.get<Checkpoint[]>(
1616
CHECKPOINTS_STATE_KEY,
1717
[]
1818
) ?? []
1919
const updated_checkpoints = checkpoints.filter(
2020
(c) => c.timestamp != params.checkpoint_to_delete.timestamp
2121
)
22-
await params.context.workspaceState.update(
22+
await params.extension_context.workspaceState.update(
2323
CHECKPOINTS_STATE_KEY,
2424
updated_checkpoints
2525
)
@@ -46,7 +46,7 @@ export type ActiveDeleteOperation = {
4646
}
4747

4848
export const delete_checkpoint_with_undo = async (params: {
49-
context: vscode.ExtensionContext
49+
extension_context: vscode.ExtensionContext
5050
checkpoint: Checkpoint
5151
panel_provider: PanelProvider
5252
get_active_operation: () => ActiveDeleteOperation | null
@@ -61,15 +61,15 @@ export const delete_checkpoint_with_undo = async (params: {
6161
}
6262

6363
const checkpoints =
64-
params.context.workspaceState.get<Checkpoint[]>(
64+
params.extension_context.workspaceState.get<Checkpoint[]>(
6565
CHECKPOINTS_STATE_KEY,
6666
[]
6767
) ?? []
6868

6969
const updated_checkpoints = checkpoints.filter(
7070
(c) => c.timestamp !== params.checkpoint.timestamp
7171
)
72-
await params.context.workspaceState.update(
72+
await params.extension_context.workspaceState.update(
7373
CHECKPOINTS_STATE_KEY,
7474
updated_checkpoints
7575
)
@@ -109,15 +109,15 @@ export const delete_checkpoint_with_undo = async (params: {
109109
) {
110110
if (choice == undo_action) {
111111
const current_checkpoints =
112-
params.context.workspaceState.get<Checkpoint[]>(
112+
params.extension_context.workspaceState.get<Checkpoint[]>(
113113
CHECKPOINTS_STATE_KEY,
114114
[]
115115
) ?? []
116116

117117
current_checkpoints.push(params.checkpoint)
118118
current_checkpoints.sort((a, b) => b.timestamp - a.timestamp)
119119

120-
await params.context.workspaceState.update(
120+
await params.extension_context.workspaceState.update(
121121
CHECKPOINTS_STATE_KEY,
122122
current_checkpoints
123123
)

‎apps/editor/src/features/checkpoints/actions/restore-checkpoint.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ export const restore_checkpoint = async (params: {
506506
)
507507
if (temp_checkpoint) {
508508
await delete_checkpoint({
509-
context: params.extension_context,
509+
extension_context: params.extension_context,
510510
checkpoint_to_delete: temp_checkpoint,
511511
panel_provider: params.panel_provider
512512
})
@@ -558,7 +558,7 @@ export const restore_checkpoint = async (params: {
558558
undefined
559559
)
560560
await delete_checkpoint({
561-
context: params.extension_context,
561+
extension_context: params.extension_context,
562562
checkpoint_to_delete: temp_check,
563563
panel_provider: params.panel_provider
564564
})

‎apps/editor/src/features/checkpoints/actions/toggle-checkpoint-star.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import type { Checkpoint } from '../types'
44
import { PanelProvider } from '@/views/panel/backend/panel-provider'
55

66
export const toggle_checkpoint_star = async (params: {
7-
context: vscode.ExtensionContext
7+
extension_context: vscode.ExtensionContext
88
timestamp: number
99
panel_provider: PanelProvider
1010
}) => {
1111
const checkpoints =
12-
params.context.workspaceState.get<Checkpoint[]>(
12+
params.extension_context.workspaceState.get<Checkpoint[]>(
1313
CHECKPOINTS_STATE_KEY,
1414
[]
1515
) ?? []
@@ -18,7 +18,7 @@ export const toggle_checkpoint_star = async (params: {
1818
)
1919
if (checkpoint_to_update) {
2020
checkpoint_to_update.is_starred = !checkpoint_to_update.is_starred
21-
await params.context.workspaceState.update(
21+
await params.extension_context.workspaceState.update(
2222
CHECKPOINTS_STATE_KEY,
2323
checkpoints
2424
)

‎apps/editor/src/features/checkpoints/actions/update-checkpoint-description.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import type { Checkpoint } from '../types'
44
import { PanelProvider } from '@/views/panel/backend/panel-provider'
55

66
export const update_checkpoint_description = async (params: {
7-
context: vscode.ExtensionContext
7+
extension_context: vscode.ExtensionContext
88
timestamp: number
99
description: string
1010
panel_provider: PanelProvider
1111
}) => {
1212
const checkpoints =
13-
params.context.workspaceState.get<Checkpoint[]>(
13+
params.extension_context.workspaceState.get<Checkpoint[]>(
1414
CHECKPOINTS_STATE_KEY,
1515
[]
1616
) ?? []
@@ -19,7 +19,7 @@ export const update_checkpoint_description = async (params: {
1919
)
2020
if (checkpoint_to_update) {
2121
checkpoint_to_update.description = params.description
22-
await params.context.workspaceState.update(
22+
await params.extension_context.workspaceState.update(
2323
CHECKPOINTS_STATE_KEY,
2424
checkpoints
2525
)

‎apps/editor/src/features/commit-messages/utils/get-commit-message-config.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface CommitMessageApiConfiguration {
1818
}
1919

2020
export const get_commit_message_api_configuration = async (
21-
context: vscode.ExtensionContext,
21+
extension_context: vscode.ExtensionContext,
2222
show_back_button: boolean = true,
2323
force_quick_pick: boolean = false,
2424
token_count?: number
@@ -31,7 +31,7 @@ export const get_commit_message_api_configuration = async (
3131
| 'back'
3232
| null
3333
> => {
34-
const model_providers_manager = new ModelProvidersManager(context)
34+
const model_providers_manager = new ModelProvidersManager(extension_context)
3535
let commit_message_api_configuration:
3636
| CommitMessageApiConfiguration
3737
| null
@@ -55,7 +55,7 @@ export const get_commit_message_api_configuration = async (
5555
if (api_configurations.length == 1 && !force_quick_pick) {
5656
commit_message_api_configuration = api_configurations[0]
5757
} else if (api_configurations.length >= 1) {
58-
const last_selected_id = context.workspaceState.get<string>(
58+
const last_selected_id = extension_context.workspaceState.get<string>(
5959
LAST_USED_COMMIT_MESSAGES_CONFIG_ID_STATE_KEY
6060
)
6161

@@ -77,7 +77,7 @@ export const get_commit_message_api_configuration = async (
7777
if (result === 'back' || !result) {
7878
commit_message_api_configuration = 'back'
7979
} else {
80-
context.workspaceState.update(
80+
extension_context.workspaceState.update(
8181
LAST_USED_COMMIT_MESSAGES_CONFIG_ID_STATE_KEY,
8282
result.id
8383
)

‎apps/editor/src/services/model-providers-manager.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class ModelProvidersManager {
3333
private _model_providers: ModelProvider[] = []
3434
private _load_promise: Promise<void>
3535

36-
constructor(private readonly _vscode: vscode.ExtensionContext) {
36+
constructor(private readonly _extension_context: vscode.ExtensionContext) {
3737
this._load_promise = this._load_providers()
3838
}
3939

@@ -48,7 +48,7 @@ export class ModelProvidersManager {
4848
}[]
4949
>('modelProviders', [])
5050

51-
const providers_json = await this._vscode.secrets.get(
51+
const providers_json = await this._extension_context.secrets.get(
5252
SECRET_STORAGE_MODEL_PROVIDERS_KEY
5353
)
5454
const saved_providers_with_keys = providers_json
@@ -76,7 +76,7 @@ export class ModelProvidersManager {
7676
public async save_model_providers(model_providers: ModelProvider[]) {
7777
try {
7878
// Save full provider info to secret storage
79-
await this._vscode.secrets.store(
79+
await this._extension_context.secrets.store(
8080
SECRET_STORAGE_MODEL_PROVIDERS_KEY,
8181
JSON.stringify(model_providers)
8282
)

0 commit comments

Comments
 (0)