Commit 7b3be8b
authored
[Python] Fix broken highlighting after case statements (#4436)
* [Python] Fix function definitions in first case branch
This commit removes `^\s*` restriction from function definitions' patterns
to ensure those are matched after first case statements.
Leading whitespace of a line after first case statement is already consumed
and scoped `meta.disable-dedentation` to support ST's indentation engine.
For consistency the restriction is globally removed, so space before `def`
keyword is never scoped `meta.function`.
* [Python] Fix class definitions in first case branch
This commit removes `^\s*` restriction from class definitions' patterns
to ensure those are matched after first case statements.
Leading whitespace of a line after first case statement is already consumed
and scoped `meta.disable-dedentation` to support ST's indentation engine.
For consistency the restriction is globally removed, so space before `class`
keyword is never scoped `meta.class`.
* [Python] Fix type definitions in first case branch
This commit removes `^\s*` restriction from type definitions' patterns
to ensure those are matched after first case statements.
Leading whitespace of a line after first case statement is already consumed
and scoped `meta.disable-dedentation` to support ST's indentation engine.
For consistency the restriction is globally removed, so space before `type`
keyword is never scoped `meta.type-alias`.
* [Python] Fix decorators in first case branch
This commit pushes a special context for special patterns right after first
case statement in order to consume decorators.
A `@` denotes an decorator only at the beginning of a line.
In any other position it is an operator.
* [Python] Verify conflict markers after case statements1 parent 2021276 commit 7b3be8b
File tree
3 files changed
+106
-14
lines changed- Python
- tests
3 files changed
+106
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
| 792 | + | |
| 793 | + | |
796 | 794 | | |
797 | 795 | | |
798 | 796 | | |
| |||
860 | 858 | | |
861 | 859 | | |
862 | 860 | | |
863 | | - | |
| 861 | + | |
864 | 862 | | |
865 | 863 | | |
866 | 864 | | |
| |||
1074 | 1072 | | |
1075 | 1073 | | |
1076 | 1074 | | |
1077 | | - | |
| 1075 | + | |
1078 | 1076 | | |
1079 | 1077 | | |
1080 | 1078 | | |
1081 | 1079 | | |
1082 | 1080 | | |
1083 | 1081 | | |
1084 | 1082 | | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
| 1083 | + | |
| 1084 | + | |
1088 | 1085 | | |
1089 | 1086 | | |
1090 | 1087 | | |
| |||
1621 | 1618 | | |
1622 | 1619 | | |
1623 | 1620 | | |
| 1621 | + | |
1624 | 1622 | | |
1625 | 1623 | | |
1626 | 1624 | | |
1627 | 1625 | | |
1628 | 1626 | | |
1629 | 1627 | | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
1630 | 1635 | | |
1631 | 1636 | | |
1632 | 1637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2146 | 2146 | | |
2147 | 2147 | | |
2148 | 2148 | | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
2149 | 2163 | | |
2150 | 2164 | | |
2151 | 2165 | | |
| |||
2310 | 2324 | | |
2311 | 2325 | | |
2312 | 2326 | | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
2313 | 2340 | | |
2314 | 2341 | | |
2315 | 2342 | | |
| |||
2389 | 2416 | | |
2390 | 2417 | | |
2391 | 2418 | | |
2392 | | - | |
2393 | | - | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
2394 | 2422 | | |
2395 | 2423 | | |
2396 | 2424 | | |
| |||
2429 | 2457 | | |
2430 | 2458 | | |
2431 | 2459 | | |
2432 | | - | |
| 2460 | + | |
2433 | 2461 | | |
2434 | 2462 | | |
2435 | 2463 | | |
| |||
2438 | 2466 | | |
2439 | 2467 | | |
2440 | 2468 | | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
2441 | 2477 | | |
2442 | 2478 | | |
2443 | 2479 | | |
| |||
2592 | 2628 | | |
2593 | 2629 | | |
2594 | 2630 | | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
2595 | 2639 | | |
2596 | 2640 | | |
2597 | 2641 | | |
| |||
3087 | 3131 | | |
3088 | 3132 | | |
3089 | 3133 | | |
3090 | | - | |
3091 | | - | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
3092 | 3139 | | |
3093 | 3140 | | |
3094 | 3141 | | |
| |||
0 commit comments