Skip to content

Commit 567aced

Browse files
committed
Rename chatPresets to webConfigurations and implement a corresponding migration
- rename 'chatPresets' to 'webConfigurations'
1 parent 4b1457e commit 567aced

5 files changed

Lines changed: 70 additions & 26 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@
884884
"scope": "resource",
885885
"default": false
886886
},
887-
"codeWebChat.chatPresets": {
887+
"codeWebChat.webConfigurations": {
888888
"type": "array",
889889
"scope": "resource",
890890
"items": {

‎apps/editor/src/extension.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
migrate_merge_configurations,
1414
migrate_preset_affix_to_prompt_template,
1515
migrate_remove_preset_groups_and_separators,
16-
migrate_merge_chat_presets
16+
migrate_merge_chat_presets,
17+
migrate_chat_presets_to_web_configurations
1718
} from './migrations'
1819
import {
1920
apply_chat_response_command,
@@ -75,6 +76,8 @@ export const activate = async (context: vscode.ExtensionContext) => {
7576
await migrate_remove_preset_groups_and_separators(context)
7677
// 9 June 2026
7778
await migrate_merge_chat_presets(context)
79+
// 11 June 2026
80+
await migrate_chat_presets_to_web_configurations(context)
7881
}
7982

8083
await migrations()

‎apps/editor/src/migrations/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export * from './migrate-merge-configurations'
88
export * from './migrate-preset-affix-to-prompt-template'
99
export * from './migrate-remove-preset-groups-and-separators'
1010
export * from './migrate-merge-chat-presets'
11-
11+
export * from './migrate-chat-presets-to-web-configurations'
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import * as vscode from 'vscode'
2+
import { Logger } from '@shared/utils/logger'
3+
4+
const MIGRATION_ID = 'chat-presets-to-web-configurations-migration-20260611'
5+
6+
export async function migrate_chat_presets_to_web_configurations(
7+
context: vscode.ExtensionContext
8+
): Promise<void> {
9+
try {
10+
if (context.globalState.get(MIGRATION_ID)) {
11+
return
12+
}
13+
14+
const config = vscode.workspace.getConfiguration('codeWebChat')
15+
const inspect = config.inspect<any[]>('chatPresets')
16+
17+
if (inspect?.globalValue !== undefined) {
18+
await config.update(
19+
'webConfigurations',
20+
inspect.globalValue,
21+
vscode.ConfigurationTarget.Global
22+
)
23+
await config.update(
24+
'chatPresets',
25+
undefined,
26+
vscode.ConfigurationTarget.Global
27+
)
28+
}
29+
30+
await context.globalState.update(MIGRATION_ID, true)
31+
Logger.info({
32+
function_name: 'migrate_chat_presets_to_web_configurations',
33+
message: 'Successfully migrated chat presets to web configurations'
34+
})
35+
} catch (error) {
36+
Logger.error({
37+
function_name: 'migrate_chat_presets_to_web_configurations',
38+
message: 'Error migrating chat presets to web configurations',
39+
data: error instanceof Error ? error.message : String(error)
40+
})
41+
}
42+
}

‎apps/editor/src/views/panel/backend/panel-provider.ts‎

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,12 @@ export class PanelProvider implements vscode.WebviewViewProvider {
445445
this._config_listener = vscode.workspace.onDidChangeConfiguration(
446446
(event) => {
447447
if (!this._webview_view) return
448-
const all_web_configuration_keys = [
449-
'codeWebChat.chatPresets'
450-
]
451-
if (all_web_configuration_keys.some((key) => event.affectsConfiguration(key))) {
448+
const all_web_configuration_keys = ['codeWebChat.webConfigurations']
449+
if (
450+
all_web_configuration_keys.some((key) =>
451+
event.affectsConfiguration(key)
452+
)
453+
) {
452454
this.send_web_configurations_to_webview(this._webview_view.webview)
453455
}
454456

@@ -624,7 +626,7 @@ export class PanelProvider implements vscode.WebviewViewProvider {
624626
}
625627

626628
public get_web_configurations_config_key(): string {
627-
return 'chatPresets'
629+
return 'webConfigurations'
628630
}
629631

630632
public cancel_all_intelligent_updates() {
@@ -795,11 +797,7 @@ export class PanelProvider implements vscode.WebviewViewProvider {
795797
} else if (message.command == 'UPDATE_WEB_CONFIGURATION') {
796798
await handle_update_web_configuration(this, message, webview_view)
797799
} else if (message.command == 'DELETE_WEB_CONFIGURATION') {
798-
await handle_delete_web_configuration(
799-
this,
800-
message,
801-
webview_view
802-
)
800+
await handle_delete_web_configuration(this, message, webview_view)
803801
} else if (message.command == 'DUPLICATE_WEB_CONFIGURATION') {
804802
await handle_duplicate_web_configuration(
805803
this,
@@ -835,9 +833,7 @@ export class PanelProvider implements vscode.WebviewViewProvider {
835833
await handle_get_api_configurations(this)
836834
} else if (message.command == 'REORDER_API_CONFIGURATIONS') {
837835
await handle_reorder_api_configurations(this, message)
838-
} else if (
839-
message.command == 'TOGGLE_PINNED_API_CONFIGURATION'
840-
) {
836+
} else if (message.command == 'TOGGLE_PINNED_API_CONFIGURATION') {
841837
await handle_toggle_pinned_api_configuration(this, message)
842838
} else if (message.command == 'SAVE_WEB_PROMPT_TYPE') {
843839
await handle_save_web_prompt_type(this, message.prompt_type)
@@ -871,7 +867,7 @@ export class PanelProvider implements vscode.WebviewViewProvider {
871867
await handle_hash_sign_quick_pick(
872868
this,
873869
this.context,
874-
message.is_for_code_completions,
870+
message.is_for_code_completions
875871
)
876872
} else if (message.command == 'GO_TO_FILE') {
877873
handle_go_to_file(message)
@@ -1012,22 +1008,17 @@ export class PanelProvider implements vscode.WebviewViewProvider {
10121008

10131009
public send_web_configurations_to_webview(_: vscode.Webview) {
10141010
const config = vscode.workspace.getConfiguration('codeWebChat')
1015-
const web_prompt_types: WebPromptType[] = [
1016-
'ask-about-context',
1017-
'find-relevant-files',
1018-
'edit-context',
1019-
'code-at-cursor',
1020-
'no-context'
1021-
]
10221011

1023-
const web_configurations_config = config.get<ConfigWebConfigurationFormat[]>('chatPresets', []) || []
1012+
const web_configurations_config =
1013+
config.get<ConfigWebConfigurationFormat[]>('webConfigurations', []) || []
10241014
const web_configurations_ui = web_configurations_config
10251015
.filter((config) => config.chatbot && CHATBOTS[config.chatbot])
10261016
.map((config) => {
10271017
let model = config.model
10281018
if (config.chatbot && model) {
10291019
const chatbot_info = CHATBOTS[config.chatbot]
1030-
const is_user_provided_supported = chatbot_info.supports_user_provided_model
1020+
const is_user_provided_supported =
1021+
chatbot_info.supports_user_provided_model
10311022
const is_model_predefined = chatbot_info.models?.[model]
10321023

10331024
if (!is_user_provided_supported && !is_model_predefined) {
@@ -1037,6 +1028,14 @@ export class PanelProvider implements vscode.WebviewViewProvider {
10371028
return config_web_configuration_to_ui_format({ ...config, model })
10381029
})
10391030

1031+
const web_prompt_types: WebPromptType[] = [
1032+
'ask-about-context',
1033+
'find-relevant-files',
1034+
'edit-context',
1035+
'code-at-cursor',
1036+
'no-context'
1037+
]
1038+
10401039
this.send_message({
10411040
command: 'WEB_CONFIGURATIONS',
10421041
web_configurations: web_configurations_ui,

0 commit comments

Comments
 (0)