Fix #5180: Handle empty .roomodes files gracefully #5263
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5180 - Mode selector missing after update due to empty .roomodes files causing schema validation errors.
Enhanced CustomModesManager to handle empty/malformed .roomodes files gracefully by detecting empty files and initializing them with proper structure, preventing 'customModes: Required' errors.
Important
Enhances
CustomModesManagerto handle empty or malformed.roomodesfiles by initializing them with default content and improving error handling.CustomModesManagernow handles empty.roomodesfiles by initializing them with a default structure usingcreateDefaultRoomodesContent().parseYamlSafely()to return an empty object for empty or whitespace-only content and handle null results from YAML parser..roomodesfiles by writing default content if schema validation fails due tocustomModestype issues.createDefaultRoomodesContent()to generate default YAML content for.roomodesfiles.loadModesFromFile()to initialize empty.roomodesfiles with default content.getCustomModesFilePath()andresetCustomModes()to usecreateDefaultRoomodesContent().CustomModesManager.This description was created by
for 08adc06. You can customize this summary. It will automatically update as commits are pushed.