mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
fix: resolve MCP server connection race condition (#5591)
- Fix 'Cannot assign to read only property all' error during extension startup - Create local copy of vscode.extensions.all to avoid read-only property conflicts - Add defensive null checking for better error handling - Resolves race condition between MCP initialization and theme loading Fixes #5591
This commit is contained in:
parent
f7b8345e19
commit
081380f470
1 changed files with 7 additions and 3 deletions
|
|
@ -37,12 +37,16 @@ export async function getTheme() {
|
|||
const colorTheme = vscode.workspace.getConfiguration("workbench").get<string>("colorTheme") || "Default Dark Modern"
|
||||
|
||||
try {
|
||||
for (let i = vscode.extensions.all.length - 1; i >= 0; i--) {
|
||||
// Create a local copy of the extensions array to avoid potential conflicts with the read-only property
|
||||
const extensions = [...vscode.extensions.all]
|
||||
|
||||
for (let i = extensions.length - 1; i >= 0; i--) {
|
||||
if (currentTheme) {
|
||||
break
|
||||
}
|
||||
const extension = vscode.extensions.all[i]
|
||||
if (extension.packageJSON?.contributes?.themes?.length > 0) {
|
||||
const extension = extensions[i]
|
||||
// Add null check for extension and packageJSON
|
||||
if (extension?.packageJSON?.contributes?.themes?.length > 0) {
|
||||
for (const theme of extension.packageJSON.contributes.themes) {
|
||||
if (theme.label === colorTheme) {
|
||||
const themePath = path.join(extension.extensionPath, theme.path)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue