Skip to content

Commit 6095c53

Browse files
author
Serge H.
committed
Merge latest changes from upstream/main
2 parents 4d80d0d + b8bf634 commit 6095c53

File tree

39 files changed

+660
-14
lines changed

39 files changed

+660
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Roo Code Changelog
22

3+
34
## [Unreleased]
45

56
### Added
67
- Add LiteLLM provider support - adapted from Cline's implementation (PR #1618) - allowing connection to any LLM via a LiteLLM proxy server. Includes configuration for API URL, API Key, and Model ID, plus cost calculation support via the `/spend/calculate` endpoint.
78

9+
=======
10+
811
## [3.11.12] - 2025-04-09
912

1013
- Make Grok3 streaming work with OpenAI Compatible (thanks @amittell!)
@@ -21,7 +24,6 @@
2124
- Follow symlinked rules files/directories to allow for more flexible rule setups
2225
- Focus Roo Code in the sidebar when running tasks in the sidebar via the API
2326
- Improve subtasks UI
24-
>>>>>>> upstream/main
2527

2628
## [3.11.10] - 2025-04-08
2729

README.md

Lines changed: 26 additions & 3 deletions
Large diffs are not rendered by default.

assets/docs/demo.gif

Lines changed: 2 additions & 2 deletions
Loading

cline_docs/settings.md

Lines changed: 202 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
## For All Settings
22

3-
1. Add the setting to ExtensionMessage.ts:
3+
1. Add the setting to schema definitions:
44

5-
- Add the setting to the ExtensionState interface
6-
- Make it required if it has a default value, optional if it can be undefined
7-
- Example: `preferredLanguage: string`
5+
- Add the item to `globalSettingsSchema` in `schemas/index.ts`
6+
- Add the item to `globalSettingsRecord` in `schemas/index.ts`
7+
- Example: `terminalCommandDelay: z.number().optional(),`
88

9-
2. Add test coverage:
9+
2. Add the setting to type definitions:
10+
11+
- Add the item to `exports/types.ts`
12+
- Add the item to `exports/roo-code.d.ts`
13+
- Add the setting to `shared/ExtensionMessage.ts`
14+
- Add the setting to the WebviewMessage type in `shared/WebviewMessage.ts`
15+
- Example: `terminalCommandDelay?: number | undefined`
16+
17+
3. Add test coverage:
1018
- Add the setting to mockState in ClineProvider.test.ts
1119
- Add test cases for setting persistence and state updates
1220
- Ensure all tests pass before submitting changes
@@ -64,12 +72,35 @@
6472
```
6573

6674
5. Add the setting to handleSubmit in SettingsView.tsx:
67-
- Add a vscode.postMessage call to send the setting's value when clicking Done
75+
76+
- Add a vscode.postMessage call to send the setting's value when clicking Save
77+
- This step is critical for persistence - without it, the setting will not be saved when the user clicks Save
6878
- Example:
6979
```typescript
7080
vscode.postMessage({ type: "multisearchDiffEnabled", bool: multisearchDiffEnabled })
7181
```
7282

83+
6. Style Considerations:
84+
- Use the VSCodeCheckbox component from @vscode/webview-ui-toolkit/react instead of HTML input elements
85+
- Wrap each checkbox in a div element for proper spacing
86+
- Use a span with className="font-medium" for the checkbox label inside the VSCodeCheckbox component
87+
- Place the description in a separate div with className="text-vscode-descriptionForeground text-sm mt-1"
88+
- Maintain consistent spacing between configuration options
89+
- Example:
90+
```typescript
91+
<div>
92+
<VSCodeCheckbox
93+
checked={terminalPowershellCounter ?? true}
94+
onChange={(e: any) => setCachedStateField("terminalPowershellCounter", e.target.checked)}
95+
data-testid="terminal-powershell-counter-checkbox">
96+
<span className="font-medium">{t("settings:terminal.powershellCounter.label")}</span>
97+
</VSCodeCheckbox>
98+
<div className="text-vscode-descriptionForeground text-sm mt-1">
99+
{t("settings:terminal.powershellCounter.description")}
100+
</div>
101+
</div>
102+
```
103+
73104
## For Select/Dropdown Settings
74105

75106
1. Add the message type to WebviewMessage.ts:
@@ -98,6 +129,7 @@
98129
- Add the setting to the return value in getState with a default value
99130
- Add the setting to the destructured variables in getStateToPostToWebview
100131
- Add the setting to the return value in getStateToPostToWebview
132+
- This step is critical for UI display - without it, the setting will not be displayed in the UI
101133
- Add a case in setWebviewMessageListener to handle the setting's message type
102134
- Example:
103135
```typescript
@@ -146,3 +178,167 @@ These steps ensure that:
146178
- The setting's value is properly synchronized between the webview and extension
147179
- The setting has a proper UI representation in the settings view
148180
- Test coverage is maintained for the new setting
181+
182+
## Adding a New Configuration Item: Summary of Required Changes
183+
184+
To add a new configuration item to the system, the following changes are necessary:
185+
186+
1. **Feature-Specific Class** (if applicable)
187+
188+
- For settings that affect specific features (e.g., Terminal, Browser, etc.)
189+
- Add a static property to store the value
190+
- Add getter/setter methods to access and modify the value
191+
192+
2. **Schema Definition**
193+
194+
- Add the item to globalSettingsSchema in schemas/index.ts
195+
- Add the item to globalSettingsRecord in schemas/index.ts
196+
197+
3. **Type Definitions**
198+
199+
- Add the item to exports/types.ts
200+
- Add the item to exports/roo-code.d.ts
201+
- Add the item to shared/ExtensionMessage.ts
202+
- Add the item to shared/WebviewMessage.ts
203+
204+
4. **UI Component**
205+
206+
- Create or update a component in webview-ui/src/components/settings/
207+
- Add appropriate slider/input controls with min/max/step values
208+
- Ensure the props are passed correctly to the component in SettingsView.tsx
209+
- Update the component's props interface to include the new settings
210+
211+
5. **Translations**
212+
213+
- Add label and description in webview-ui/src/i18n/locales/en/settings.json
214+
- Update all other languages
215+
- If any language content is changed, synchronize all other languages with that change
216+
- Translations must be performed within "translation" mode so change modes for that purpose
217+
218+
6. **State Management**
219+
220+
- Add the item to the destructuring in SettingsView.tsx
221+
- Add the item to the handleSubmit function in SettingsView.tsx
222+
- Add the item to getStateToPostToWebview in ClineProvider.ts
223+
- Add the item to getState in ClineProvider.ts with appropriate default values
224+
- Add the item to the initialization in resolveWebviewView in ClineProvider.ts
225+
226+
7. **Message Handling**
227+
228+
- Add a case for the item in webviewMessageHandler.ts
229+
230+
8. **Implementation-Specific Logic**
231+
232+
- Implement any feature-specific behavior triggered by the setting
233+
- Examples:
234+
- Environment variables for terminal settings
235+
- API configuration changes for provider settings
236+
- UI behavior modifications for display settings
237+
238+
9. **Testing**
239+
240+
- Add test cases for the new settings in appropriate test files
241+
- Verify settings persistence and state updates
242+
243+
10. **Ensuring Settings Persistence Across Reload**
244+
245+
To ensure settings persist across application reload, several key components must be properly configured:
246+
247+
1. **Initial State in ExtensionStateContextProvider**:
248+
249+
- Add the setting to the initial state in the useState call
250+
- Example:
251+
```typescript
252+
const [state, setState] = useState<ExtensionState>({
253+
// existing settings...
254+
newSetting: false, // Default value for the new setting
255+
})
256+
```
257+
258+
2. **State Loading in ClineProvider**:
259+
260+
- Add the setting to the getState method to load it from storage
261+
- Example:
262+
```typescript
263+
return {
264+
// existing settings...
265+
newSetting: stateValues.newSetting ?? false,
266+
}
267+
```
268+
269+
3. **State Initialization in resolveWebviewView**:
270+
271+
- Add the setting to the initialization in resolveWebviewView
272+
- Example:
273+
```typescript
274+
this.getState().then(
275+
({
276+
// existing settings...
277+
newSetting,
278+
}) => {
279+
// Initialize the setting with its stored value or default
280+
FeatureClass.setNewSetting(newSetting ?? false)
281+
},
282+
)
283+
```
284+
285+
4. **State Transmission to Webview**:
286+
287+
- Add the setting to the getStateToPostToWebview method
288+
- Example:
289+
```typescript
290+
return {
291+
// existing settings...
292+
newSetting: newSetting ?? false,
293+
}
294+
```
295+
296+
5. **Setter Method in ExtensionStateContext**:
297+
- Add the setter method to the contextValue object
298+
- Example:
299+
```typescript
300+
const contextValue: ExtensionStateContextType = {
301+
// existing properties and methods...
302+
setNewSetting: (value) => setState((prevState) => ({ ...prevState, newSetting: value })),
303+
}
304+
```
305+
306+
11. **Debugging Settings Persistence Issues**
307+
308+
If a setting is not persisting across reload, check the following:
309+
310+
1. **Complete Chain of Persistence**:
311+
312+
- Verify that the setting is added to all required locations:
313+
- globalSettingsSchema and globalSettingsRecord in schemas/index.ts
314+
- Initial state in ExtensionStateContextProvider
315+
- getState method in ClineProvider.ts
316+
- getStateToPostToWebview method in ClineProvider.ts
317+
- resolveWebviewView method in ClineProvider.ts (if feature-specific)
318+
- A break in any part of this chain can prevent persistence
319+
320+
2. **Default Values Consistency**:
321+
322+
- Ensure default values are consistent across all locations
323+
- Inconsistent defaults can cause unexpected behavior
324+
325+
3. **Message Handling**:
326+
327+
- Confirm the webviewMessageHandler.ts has a case for the setting
328+
- Verify the message type matches what's sent from the UI
329+
330+
4. **UI Integration**:
331+
332+
- Check that the setting is included in the handleSubmit function in SettingsView.tsx
333+
- Ensure the UI component correctly updates the state
334+
335+
5. **Type Definitions**:
336+
337+
- Verify the setting is properly typed in all relevant interfaces
338+
- Check for typos in property names across different files
339+
340+
6. **Storage Mechanism**:
341+
- For complex settings, ensure proper serialization/deserialization
342+
- Check that the setting is being correctly stored in VSCode's globalState
343+
344+
These checks help identify and resolve common issues with settings persistence.

0 commit comments

Comments
 (0)