-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Implement array comparison utility and update global state conditionally in extension activation bug 2625 #3432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lly in extension activation - Added `areArraysEqual` utility function to compare two arrays of strings for equality, handling null/undefined inputs. - Updated the `activate` function to only update the global state for allowed commands if the current commands differ from the defaults. - Introduced tests for the new utility function and modified tests for the extension activation to ensure correct behavior. - Enhanced `AutoApproveSettings` component to conditionally update settings based on the comparison with default commands.
|
|
|
||
| // Get default commands from configuration. | ||
| const defaultCommands = vscode.workspace.getConfiguration("roo-cline").get<string[]>("allowedCommands") || [] | ||
| const currentCommands = context.globalState.get<string[]>("allowedCommands") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we compare the settings for the commands before force re-write. its just a check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basic util file for checking two arrays
| Hint: 3, | ||
| }, | ||
| languages: { | ||
| getDiagnostics: jest.fn().mockReturnValue([]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bug fix for one of the test I ran but failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not related to #2625
| import { Section } from "./Section" | ||
| import { AutoApproveToggle } from "./AutoApproveToggle" | ||
|
|
||
| // Default allowed commands from package.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set hard coded default command, not sure if you guys are happy about this
…
areArraysEqualutility function to compare two arrays of strings for equality, handling null/undefined inputs.activatefunction to only update the global state for allowed commands if the current commands differ from the defaults.AutoApproveSettingscomponent to conditionally update settings based on the comparison with default commands.Related GitHub Issue
Closes: #2625
Description
Test Procedure
Type of Change
srcor test files.Pre-Submission Checklist
npm run lint).console.log) has been removed.npm test).mainbranch.npm run changesetif this PR includes user-facing changes or dependency updates.Screenshots / Videos
Documentation Updates
Additional Notes