Skip to content

Commit bb885d3

Browse files
Updates switch iteration
1 parent f956860 commit bb885d3

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

data/fixtures/scopes/python/branch.switchCase.iteration.scope

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ match 0:
55
pass
66
---
77

8-
[Range] =
8+
[Range] = 0:8-4:12
9+
>
10+
0| match 0:
11+
1| case [0]:
12+
2| pass
13+
3| case [1]:
14+
4| pass
15+
------------<
16+
917
[Domain] = 0:0-4:12
1018
>--------
1119
0| match 0:

data/fixtures/scopes/python/condition.for.scope

Lines changed: 0 additions & 4 deletions
This file was deleted.

data/fixtures/scopes/python/condition.switchCase.iteration.scope

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ match value:
55
pass
66
---
77

8-
[Range] =
8+
[Range] = 0:12-4:12
9+
>
10+
0| match value:
11+
1| case 0:
12+
2| pass
13+
3| case 1:
14+
4| pass
15+
------------<
16+
917
[Domain] = 0:0-4:12
1018
>------------
1119
0| match value:

packages/common/src/scopeSupportFacets/python.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
105105

106106
switchStatementSubject: supported,
107107

108-
"condition.for": supported,
108+
"condition.if": supported,
109109
"condition.switchCase": supported,
110110
"condition.switchCase.iteration": supported,
111111
"condition.ternary": supported,
@@ -115,7 +115,6 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
115115
"key.mapPair": supported,
116116
list: supported,
117117
map: supported,
118-
"condition.if": supported,
119118

120119
"comment.line": supported,
121120

@@ -146,6 +145,7 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
146145
"className.iteration.block": notApplicable,
147146
"comment.block": notApplicable,
148147
"condition.doWhile": notApplicable,
148+
"condition.for": notApplicable,
149149
"interior.cell": notApplicable,
150150
"interior.command": notApplicable,
151151
"interior.element": notApplicable,

queries/python.scm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@
406406
;;! ^^^^^^^^^^^^
407407
(case_clause) @branch
408408

409-
(match_statement) @branch.iteration @condition.iteration
409+
(match_statement
410+
body: (_) @branch.iteration @condition.iteration
411+
) @branch.iteration.domain @condition.iteration.domain
410412

411413
;;!! 1 if True else 0
412414
;;! ^^^^

0 commit comments

Comments
 (0)