Skip to content

Commit

Permalink
branch
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Dec 7, 2023
1 parent a5ebef6 commit 4496739
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 33 deletions.
19 changes: 13 additions & 6 deletions packages/common/src/scopeSupportFacets/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ export const javascriptScopeSupport: LanguageScopeSupportFacetMap = {

ifStatement: supported,

functionCall: supported,
"functionCall.constructor": supported,
functionCallee: supported,
"functionCallee.constructor": supported,

class: supported,
className: supported,

Expand All @@ -27,15 +22,27 @@ export const javascriptScopeSupport: LanguageScopeSupportFacetMap = {
"anonymousFunction.lambda": supported,
functionName: supported,

functionCall: supported,
"functionCall.constructor": supported,
functionCallee: supported,
"functionCallee.constructor": supported,

"comment.line": supported,
"comment.block": supported,

"string.singleLine": supported,
"string.multiLine": supported,

"branch.if": supported,
"branch.try": supported,
"branch.switchCase": supported,

"condition.if": supported,
"condition.while": supported,
"condition.doWhile": supported,
"condition.for": supported,
"condition.ternary": supported,
"condition.switch": supported,
"condition.switchCase": supported,

"name.foreach": supported,
"name.assignment": supported,
Expand Down
58 changes: 40 additions & 18 deletions packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,6 @@ export const scopeSupportFacetInfos: Record<
scopeType: "ifStatement",
},

functionCall: {
description: "A function call",
scopeType: "functionCall",
},
"functionCall.constructor": {
description: "A constructor call",
scopeType: "functionCall",
},
functionCallee: {
description: "The callee of a function call",
scopeType: "functionCallee",
},
"functionCallee.constructor": {
description: "The callee of a constructor call",
scopeType: "functionCallee",
},

class: {
description: "A class",
scopeType: "class",
Expand Down Expand Up @@ -83,6 +66,23 @@ export const scopeSupportFacetInfos: Record<
scopeType: "functionName",
},

functionCall: {
description: "A function call",
scopeType: "functionCall",
},
"functionCall.constructor": {
description: "A constructor call",
scopeType: "functionCall",
},
functionCallee: {
description: "The callee of a function call",
scopeType: "functionCallee",
},
"functionCallee.constructor": {
description: "The callee of a constructor call",
scopeType: "functionCallee",
},

"comment.line": {
description: "A line comment",
scopeType: "comment",
Expand All @@ -92,6 +92,28 @@ export const scopeSupportFacetInfos: Record<
scopeType: "comment",
},

"string.singleLine": {
description: "A single line string",
scopeType: "string",
},
"string.multiLine": {
description: "A multi line string",
scopeType: "string",
},

"branch.if": {
description: "An if/elif/else branch",
scopeType: "branch",
},
"branch.try": {
description: "A try/catch/finally branch",
scopeType: "branch",
},
"branch.switchCase": {
description: "A switch/case/default branch",
scopeType: "branch",
},

"condition.if": {
description: "A condition in an if statement",
scopeType: "condition",
Expand All @@ -112,7 +134,7 @@ export const scopeSupportFacetInfos: Record<
description: "A condition in a ternary expression",
scopeType: "condition",
},
"condition.switch": {
"condition.switchCase": {
description: "A condition in a switch statement",
scopeType: "condition",
},
Expand Down
22 changes: 13 additions & 9 deletions packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ const scopeSupportFacets = [

"ifStatement",

"functionCall",
"functionCall.constructor",
"functionCallee",
"functionCallee.constructor",

"class",
"className",
"namedFunction",
Expand All @@ -23,15 +18,27 @@ const scopeSupportFacets = [
"anonymousFunction.lambda",
"functionName",

"functionCall",
"functionCall.constructor",
"functionCallee",
"functionCallee.constructor",

"comment.line",
"comment.block",

"string.singleLine",
"string.multiLine",

"branch.if",
"branch.try",
"branch.switchCase",

"condition.if",
"condition.while",
"condition.doWhile",
"condition.for",
"condition.ternary",
"condition.switch",
"condition.switchCase",

"name.assignment",
"name.foreach",
Expand All @@ -52,9 +59,6 @@ const scopeSupportFacets = [

// "statement",

// "branch",
// "string.singleLine",
// "string.multiLine",
// "textFragment",
// "argumentOrParameter.argument",
// "argumentOrParameter.parameter",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
if (true) {

}
else if (false) {

}
else {

}
---

[#1 Content] =
[#1 Domain] = 0:0-2:1
0| if (true) {
>-----------
1|

2| }
-<
3| else if (false) {

4|

5| }

6| else {

7|

8| }


[#1 Removal] = 0:0-3:5
0| if (true) {
>-----------
1|

2| }
-
3| else if (false) {
-----<
4|

5| }

6| else {

7|

8| }


[#1 Insertion delimiter] = "\n"


[#2 Content] =
[#2 Removal] =
[#2 Domain] = 3:0-5:1
0| if (true) {

1|

2| }

3| else if (false) {
>-----------------
4|

5| }
-<
6| else {

7|

8| }


[#2 Insertion delimiter] = "\n"


[#3 Content] =
[#3 Removal] =
[#3 Domain] = 6:0-8:1
0| if (true) {

1|

2| }

3| else if (false) {

4|

5| }

6| else {
>------
7|

8| }
-<

[#3 Insertion delimiter] = "\n"
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
switch (value) {
case 0: { }
}
---

[Content] =
[Domain] = 1:2-1:13
0| switch (value) {

1| case 0: { }
>-----------<
2| }


[Removal] = 1:0-1:13
0| switch (value) {

1| case 0: { }
>-------------<
2| }


[Leading delimiter] = 1:0-1:2
0| switch (value) {

1| case 0: { }
>--<
2| }


[Insertion delimiter] = "\n"
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
try {

}
catch(error) {

}
finally {

}
---

[#1 Content] =
[#1 Removal] =
[#1 Domain] = 0:0-2:1
0| try {
>-----
1|

2| }
-<
3| catch(error) {

4|

5| }

6| finally {

7|

8| }


[#1 Insertion delimiter] = "\n"


[#2 Content] =
[#2 Removal] =
[#2 Domain] = 3:0-5:1
0| try {

1|

2| }

3| catch(error) {
>--------------
4|

5| }
-<
6| finally {

7|

8| }


[#2 Insertion delimiter] = "\n"


[#3 Content] =
[#3 Removal] =
[#3 Domain] = 6:0-8:1
0| try {

1|

2| }

3| catch(error) {

4|

5| }

6| finally {
>---------
7|

8| }
-<

[#3 Insertion delimiter] = "\n"
Loading

0 comments on commit 4496739

Please sign in to comment.