Skip to content

Commit c78216a

Browse files
authored
Fix issue where sound effects setting wasn't working (#51)
1 parent e180205 commit c78216a

File tree

6 files changed

+34
-4
lines changed

6 files changed

+34
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Roo Cline Changelog
22

3+
## [2.1.13]
4+
5+
- Fix https://github.com/RooVetGit/Roo-Cline/issues/50 where sound effects were not respecting settings
6+
37
## [2.1.12]
48

59
- Incorporate JoziGila's [PR](https://github.com/cline/cline/pull/158) to add support for editing through diffs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A fork of Cline, an autonomous coding agent, with some added experimental config
88
- Support for OpenRouter compression
99
- Support for editing through diffs
1010

11-
Creating a snake game with "Always approve write operations" and "Always approve browser actions":
11+
Here's an example of Roo-Cline autonomously creating a snake game with "Always approve write operations" and "Always approve browser actions" turned on:
1212

1313
https://github.com/user-attachments/assets/c2bb31dc-e9b2-4d73-885d-17f1471a4987
1414

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Roo Cline",
44
"description": "A fork of Cline, an autonomous coding agent, with some added experimental configuration and automation features.",
55
"publisher": "RooVeterinaryInc",
6-
"version": "2.1.12",
6+
"version": "2.1.13",
77
"icon": "assets/icons/rocket.png",
88
"galleryBanner": {
99
"color": "#617A91",

src/core/webview/ClineProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
539539
case "soundEnabled":
540540
const soundEnabled = message.bool ?? true
541541
await this.updateGlobalState("soundEnabled", soundEnabled)
542+
setSoundEnabled(soundEnabled) // Add this line to update the sound utility
542543
await this.postStateToWebview()
543544
break
544545
case "diffEnabled":

src/core/webview/__tests__/ClineProvider.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ClineProvider } from '../ClineProvider'
22
import * as vscode from 'vscode'
33
import { ExtensionMessage, ExtensionState } from '../../../shared/ExtensionMessage'
4+
import { setSoundEnabled } from '../../../utils/sound'
45

56
// Mock dependencies
67
jest.mock('vscode', () => ({
@@ -25,6 +26,11 @@ jest.mock('vscode', () => ({
2526
}
2627
}))
2728

29+
// Mock sound utility
30+
jest.mock('../../../utils/sound', () => ({
31+
setSoundEnabled: jest.fn()
32+
}))
33+
2834
// Mock ESM modules
2935
jest.mock('p-wait-for', () => ({
3036
__esModule: true,
@@ -233,4 +239,23 @@ describe('ClineProvider', () => {
233239
expect(state).toHaveProperty('soundEnabled')
234240
expect(state).toHaveProperty('diffEnabled')
235241
})
242+
243+
test('updates sound utility when sound setting changes', async () => {
244+
provider.resolveWebviewView(mockWebviewView)
245+
246+
// Get the message handler from onDidReceiveMessage
247+
const messageHandler = (mockWebviewView.webview.onDidReceiveMessage as jest.Mock).mock.calls[0][0]
248+
249+
// Simulate setting sound to enabled
250+
await messageHandler({ type: 'soundEnabled', bool: true })
251+
expect(setSoundEnabled).toHaveBeenCalledWith(true)
252+
expect(mockContext.globalState.update).toHaveBeenCalledWith('soundEnabled', true)
253+
expect(mockPostMessage).toHaveBeenCalled()
254+
255+
// Simulate setting sound to disabled
256+
await messageHandler({ type: 'soundEnabled', bool: false })
257+
expect(setSoundEnabled).toHaveBeenCalledWith(false)
258+
expect(mockContext.globalState.update).toHaveBeenCalledWith('soundEnabled', false)
259+
expect(mockPostMessage).toHaveBeenCalled()
260+
})
236261
})

0 commit comments

Comments
 (0)