Skip to content

Commit 7259365

Browse files
fix: automatically remove duplicate repositories from configuration
1 parent a841dc6 commit 7259365

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ All notable changes to the "promptitude" extension will be documented in this fi
1717
- Fixed "Deactivate All" to efficiently remove all symlinks directly instead of looping through individual toggles, eliminating unnecessary counting behavior.
1818
- Fixed issue where prompts that were active before "Activate All" would be in a broken state after "Deactivate All".
1919
- Fixed prompt details view not refreshing when "Deactivate All" is clicked while viewing an active prompt.
20+
- Fixed duplicate repositories persisting in configuration by automatically removing them and updating settings when detected.
2021

2122
## [1.5.0] - 2025-11-12
2223

src/configManager.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,26 @@ export class ConfigManager {
4848
.map(r => (r ?? '').trim())
4949
.filter(r => r.length > 0);
5050
const uniqueArray = Array.from(new Set(sanitized));
51+
52+
// If duplicates were found, update the configuration to remove them.
5153
if (uniqueArray.length !== repository.length) {
52-
vscode.window.showWarningMessage('Duplicate repository URLs found in configuration. Duplicates have been removed.');
54+
this.logger.info(`Removing ${repository.length - uniqueArray.length} duplicate repository URL(s) from configuration`);
55+
56+
// Update the configuration to persist the deduplicated list.
57+
vscode.workspace.getConfiguration('promptitude')
58+
.update('repositories', uniqueArray, vscode.ConfigurationTarget.Global)
59+
.then(() => {
60+
vscode.window.showInformationMessage(
61+
`Removed ${repository.length - uniqueArray.length} duplicate repository URL(s) from configuration.`
62+
);
63+
}, (error) => {
64+
this.logger.error('Failed to update repositories configuration', error);
65+
vscode.window.showWarningMessage(
66+
`Found ${repository.length - uniqueArray.length} duplicate repository URL(s) but failed to update configuration. Please remove duplicates manually.`
67+
);
68+
});
5369
}
70+
5471
return uniqueArray;
5572
}
5673

0 commit comments

Comments
 (0)