Skip to content

Commit cca2284

Browse files
Add support for Java record statements (#3089)
1 parent 8776f68 commit cca2284

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public record Foo(int a) {}
2+
---
3+
4+
[Content] =
5+
[Removal] =
6+
[Domain] = 0:0-0:27
7+
>---------------------------<
8+
0| public record Foo(int a) {}
9+
10+
[Insertion delimiter] = "\n"

packages/common/src/scopeSupportFacets/java.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
114114
"statement.continue": supported,
115115
"statement.resource": supported,
116116
"statement.static": supported,
117+
"statement.misc": supported,
117118
"statement.iteration.document": supported,
118119
"statement.iteration.class": supported,
119120
"statement.iteration.interface": supported,
@@ -301,7 +302,6 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
301302
"value.iteration.enum": notApplicable,
302303

303304
// Miscellaneous
304-
"statement.misc": notApplicable,
305305
pairDelimiter: notApplicable,
306306
regularExpression: notApplicable,
307307
environment: notApplicable,

queries/java.scm

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
(field_declaration)
3333
(constant_declaration)
3434
(static_initializer)
35+
(record_declaration)
3536

3637
;; Disabled on purpose. We don't consider these to be statements.
3738
;; exceptions
@@ -138,17 +139,14 @@
138139

139140
;;!! "string"
140141
;;! ^^^^^^^^
141-
(
142-
(string_literal) @string @textFragment
143-
(#character-range! @textFragment 1 -1)
144-
)
145-
146142
;;!! """string"""
147143
;;! ^^^^^^^^^^^^
148-
(
149-
(text_block) @string @textFragment
150-
(#character-range! @textFragment 3 -3)
151-
)
144+
(string_literal) @string
145+
146+
[
147+
(string_fragment)
148+
(multiline_string_fragment)
149+
] @textFragment
152150

153151
;;!! // comment
154152
;;! ^^^^^^^^^^

0 commit comments

Comments
 (0)