Skip to content

Commit c04eb6a

Browse files
committed
Set resource scope for contextSizeWarningThreshold setting to enable workspace-specific configuration
1 parent 50f4844 commit c04eb6a

4 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@
642642
"default": 5
643643
},
644644
"codeWebChat.contextSizeWarningThreshold": {
645-
"type": "number"
645+
"type": "number",
646+
"scope": "resource"
646647
},
647648
"codeWebChat.checkpointLifespan": {
648649
"type": "number",

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,9 @@ export class PanelProvider implements vscode.WebviewViewProvider {
860860
private _send_context_size_warning_threshold() {
861861
if (!this._webview_view) return
862862
const config = vscode.workspace.getConfiguration('codeWebChat')
863-
const threshold = config.get<number>(
864-
'contextSizeWarningThreshold',
863+
const threshold =
864+
config.get<number>('contextSizeWarningThreshold') ||
865865
DEFAULT_CONTEXT_SIZE_WARNING_THRESHOLD
866-
)
867866
this.send_message({
868867
command: 'CONTEXT_SIZE_WARNING_THRESHOLD',
869868
threshold

‎apps/editor/src/views/settings/backend/message-handlers/handle-get-context-size-warning-threshold.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ export const handle_get_context_size_warning_threshold = async (
66
provider: SettingsProvider
77
): Promise<void> => {
88
const config = vscode.workspace.getConfiguration('codeWebChat')
9-
const threshold = config.get<number>(
10-
'contextSizeWarningThreshold',
9+
const threshold =
10+
config.get<number>('contextSizeWarningThreshold') ||
1111
DEFAULT_CONTEXT_SIZE_WARNING_THRESHOLD
12-
)
1312
provider.postMessage({
1413
command: 'CONTEXT_SIZE_WARNING_THRESHOLD',
1514
threshold

‎apps/editor/src/views/settings/frontend/hooks/use-settings.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const use_settings = (vscode: any) => {
3939
set_edit_context_system_instructions
4040
] = useState<string | undefined>(undefined)
4141
const [context_size_warning_threshold, set_context_size_warning_threshold] =
42-
useState<number | undefined>(undefined)
42+
useState<number>()
4343
const [edit_format_instructions, set_edit_format_instructions] = useState<
4444
EditFormatInstructions | undefined
4545
>(undefined)

0 commit comments

Comments
 (0)