Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public class MyClass {
String foo, bar;
}
---

[Range] = 1:11-1:19
>--------<
1| String foo, bar;

[Domain] = 1:4-1:20
>----------------<
1| String foo, bar;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class MyClass {
public void myFunk() {
String foo, bar;
}
}
---

[Range] = 2:15-2:23
>--------<
2| String foo, bar;

[Domain] = 2:8-2:24
>----------------<
2| String foo, bar;
35 changes: 35 additions & 0 deletions data/fixtures/scopes/java/collectionItem.unenclosed.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
public class MyClass {
String foo, bar;
}
---

[#1 Content] =
[#1 Domain] = 1:11-1:14
>---<
1| String foo, bar;

[#1 Removal] = 1:11-1:16
>-----<
1| String foo, bar;

[#1 Trailing delimiter] = 1:14-1:16
>--<
1| String foo, bar;

[#1 Insertion delimiter] = ", "


[#2 Content] =
[#2 Domain] = 1:16-1:19
>---<
1| String foo, bar;

[#2 Removal] = 1:14-1:19
>-----<
1| String foo, bar;

[#2 Leading delimiter] = 1:14-1:16
>--<
1| String foo, bar;

[#2 Insertion delimiter] = ", "
37 changes: 37 additions & 0 deletions data/fixtures/scopes/java/collectionItem.unenclosed2.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
public class MyClass {
public void myFunk() {
String foo, bar;
}
}
---

[#1 Content] =
[#1 Domain] = 2:15-2:18
>---<
2| String foo, bar;

[#1 Removal] = 2:15-2:20
>-----<
2| String foo, bar;

[#1 Trailing delimiter] = 2:18-2:20
>--<
2| String foo, bar;

[#1 Insertion delimiter] = ", "


[#2 Content] =
[#2 Domain] = 2:20-2:23
>---<
2| String foo, bar;

[#2 Removal] = 2:18-2:23
>-----<
2| String foo, bar;

[#2 Leading delimiter] = 2:18-2:20
>--<
2| String foo, bar;

[#2 Insertion delimiter] = ", "
13 changes: 8 additions & 5 deletions packages/common/src/scopeSupportFacets/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
"argument.actual": supported,
"argument.actual.iteration": supported,

element: notApplicable,
tags: notApplicable,
attribute: notApplicable,
"key.attribute": notApplicable,
"value.attribute": notApplicable,
"collectionItem.unenclosed": supported,
"collectionItem.unenclosed.iteration": supported,

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

element: notApplicable,
tags: notApplicable,
attribute: notApplicable,
"key.attribute": notApplicable,
"value.attribute": notApplicable,
};
44 changes: 44 additions & 0 deletions queries/java.scm
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,57 @@
value: (_)? @value @name.trailing.startOf
)
) @_.domain

(field_declaration
(variable_declarator
name: (_) @name @value.leading.endOf
value: (_)? @value @name.trailing.startOf
)
) @_.domain

;;!! int foo, bar;
;;! ^^^ ^^^
(
(local_variable_declaration
type: (_)
(variable_declarator)? @_.leading.endOf
.
(variable_declarator) @collectionItem
.
(variable_declarator)? @_.trailing.startOf
)
(#insertion-delimiter! @collectionItem ", ")
)

(
(field_declaration
type: (_)
(variable_declarator)? @_.leading.endOf
.
(variable_declarator) @collectionItem
.
(variable_declarator)? @_.trailing.startOf
)
(#insertion-delimiter! @collectionItem ", ")
)

;;!! int foo, bar;
;;! ^^^^^^^^
;;! -------------
(local_variable_declaration
type: (_)
.
(_) @collectionItem.iteration.start.startOf
";"? @collectionItem.iteration.end.startOf
) @collectionItem.iteration.domain

(field_declaration
type: (_)
.
(_) @collectionItem.iteration.start.startOf
";"? @collectionItem.iteration.end.startOf
) @collectionItem.iteration.domain

;;!! value = 1;
;;! ^
;;! xxxx
Expand Down
Loading