fix(config): skip {file:} substitution only when no active lines match#14545
Open
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
Open
fix(config): skip {file:} substitution only when no active lines match#14545kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
Conversation
…token findIndex returns the first line containing the token, which may be a comment. When it is, substitution is skipped entirely even if the same token appears on a later active line. Fix by filtering out commented lines in the findIndex predicate so we only skip tokens that truly have no non-comment occurrences. Fixes anomalyco#14478
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Closes #14478
Type of change
What does this PR do?
load()in config.ts useslines.findIndex()to locate{file:...}tokens for substitution. If the first line containing the token is a comment,continueskips substitution for that token entirely — even when the same token appears on a later non-comment line.Moved the comment check into the
findIndexpredicate so it finds the first non-comment line with the token. If no non-comment line contains it, the token is correctly skipped.Before:
After:
How did you verify your code works?
Tested with a jsonc config containing both a commented and active
{file:...}token pointing to the same path. Before the fix the token stayed literal; after, it resolves correctly.Screenshots / recordings
Not a UI change.
Checklist