mirror of
https://github.com/nvim-treesitter/nvim-treesitter-context
synced 2024-09-16 14:14:03 +02:00
feat: multiline support
This commit is contained in:
parent
cfa8ee19ac
commit
c8e81cbceb
2 changed files with 164 additions and 12 deletions
|
@ -1,7 +1,29 @@
|
|||
([
|
||||
(class_definition)
|
||||
(try_statement)
|
||||
(if_statement)
|
||||
(function_body)
|
||||
(for_statement)
|
||||
] @context)
|
||||
(function_body) @context
|
||||
|
||||
(for_statement
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(while_statement
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(do_statement
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(try_statement
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(if_statement
|
||||
consequence: (_) @context.end
|
||||
) @context
|
||||
|
||||
(class_definition
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(extension_declaration
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
|
140
test/test.dart
140
test/test.dart
|
@ -1,5 +1,8 @@
|
|||
|
||||
class User {
|
||||
@Deprecated('')
|
||||
abstract
|
||||
class User
|
||||
extends
|
||||
Object {
|
||||
User(this.age);
|
||||
int age;
|
||||
|
||||
|
@ -34,14 +37,22 @@ class User {
|
|||
|
||||
}
|
||||
|
||||
String (int magicalNumber) {
|
||||
if (magicalNumber == "69") {
|
||||
String(
|
||||
int magicalNumber,
|
||||
) {
|
||||
if (magicalNumber == "69"
|
||||
// --
|
||||
||
|
||||
magicalNumber == "420") {
|
||||
return 'pretty nice';
|
||||
|
||||
|
||||
|
||||
|
||||
} else if (magicalNumber == "420"){
|
||||
} else if (magicalNumber == "420" // -
|
||||
&&
|
||||
magicalNumber == "69") {
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -66,4 +77,123 @@ String (int magicalNumber) {
|
|||
return 'pretty high';
|
||||
}
|
||||
return 'just decent';
|
||||
}
|
||||
|
||||
|
||||
void catching() {
|
||||
try
|
||||
// --
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (e) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} finally {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void foring() {
|
||||
for (int i = 0; // -
|
||||
i < 10;
|
||||
i++) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
while (true // --
|
||||
== false) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
do {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} while (true);
|
||||
}
|
||||
|
||||
extension ext
|
||||
on int {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue