Fixes #5139: Improve YAML error line number extraction for .roomodes files #5255
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.
Summary
This PR fixes issue #5139 where users were experiencing YAML parsing errors in .roomodes files after updating to v3.22.0, specifically addressing problems with line number extraction from YAML error messages.
Problem
Users reported getting generic error messages like:
The issue was that the line number extraction logic in CustomModesManager was only looking for one specific error message format pattern, but the YAML library can produce different error message formats.
Solution
Enhanced the line number extraction logic in
src/core/config/CustomModesManager.tsto handle multiple YAML error message formats:at line X- Original patternline X- Alternative pattern(line:column)- Parenthesized formatline:column- Direct formatThe fix tries multiple regex patterns in order and uses the first match found, falling back to 'unknown' if no line number can be extracted.
Changes
parseYamlSafely()method in CustomModesManager to use multiple line number extraction patternsTesting
Fixes #5139
Important
Improves line number extraction from YAML error messages in
CustomModesManager.tsto handle multiple formats for better error reporting in.roomodesfiles.parseYamlSafely()inCustomModesManager.tsto handle multiple YAML error message formats.at line X,line X,(line:column), andline:column.This description was created by
for 445cd63. You can customize this summary. It will automatically update as commits are pushed.