Closed aleclarson closed 2 days ago
@hediet Excuse me if it's rude to tag, but I saw you're the only person to touch src/theme.ts
in the last 2 years, so I would very much appreciate a code review if you can find the time! :heart:
Test cases incoming...
Okay tests have been added! Both fail on main branch.
Closes #123
Feature: Add support for the child combinator (the
>
operator). This allows for styling a parent-child relationship specifically.https://github.com/microsoft/vscode-textmate/blob/d63ed169dfa50fe337d6985b658103cb47829abe/src/theme.ts#L173-L180
https://github.com/microsoft/vscode-textmate/blob/d63ed169dfa50fe337d6985b658103cb47829abe/src/theme.ts#L526-L532
Bug: If the number of scope names in both rules‘ scope paths are not equal, the parent scope names won‘t be compared at all. Instead, the rule with the longest scope path is preferred. This goes against the TextMate manual (https://macromates.com/manual/en/scope_selectors). In particular, the following line in “Ranking Matches”:
https://github.com/microsoft/vscode-textmate/blob/09effd8b7429b71010e0fa34ea2e16e622692946/src/theme.ts#L506-L515
How did I fix it?
Do a depth-first, scope-by-scope comparison of the parent scopes, even if one of the rules has a longer scope path.
https://github.com/microsoft/vscode-textmate/blob/7c14889ce5b178313f13bc0ef1d1e06d3541ffcc/src/theme.ts#L539-L553
Tests