-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from malkoG/master
Support tag query
- Loading branch information
Showing
6 changed files
with
370 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
|
||
(class_definition | ||
name: (identifier) @name) @definition.class | ||
|
||
(method_signature | ||
(function_signature)) @definition.method | ||
|
||
(type_alias | ||
(type_identifier) @name) @definition.type | ||
|
||
(method_signature | ||
(getter_signature | ||
name: (identifier) @name)) @definition.method | ||
|
||
(method_signature | ||
(setter_signature | ||
name: (identifier) @name)) @definition.method | ||
|
||
(method_signature | ||
(function_signature | ||
name: (identifier) @name)) @definition.method | ||
|
||
(method_signature | ||
(factory_constructor_signature | ||
(identifier) @name)) @definition.method | ||
|
||
(method_signature | ||
(constructor_signature | ||
name: (identifier) @name)) @definition.method | ||
|
||
(method_signature | ||
(operator_signature)) @definition.method | ||
|
||
(method_signature) @definition.method | ||
|
||
(mixin_declaration | ||
(mixin) | ||
(identifier) @name) @definition.mixin | ||
|
||
(extension_declaration | ||
name: (identifier) @name) @definition.extension | ||
|
||
|
||
(new_expression | ||
(type_identifier) @name) @reference.class | ||
|
||
(enum_declaration | ||
name: (identifier) @name) @definition.enum | ||
|
||
(function_signature | ||
name: (identifier) @name) @definition.function | ||
|
||
(initialized_variable_definition | ||
name: (identifier) | ||
value: (identifier) @name | ||
value: (selector | ||
"!"? | ||
(argument_part | ||
(arguments | ||
(argument)*))?)?) @reference.class | ||
|
||
(assignment_expression | ||
left: (assignable_expression | ||
(identifier) | ||
(unconditional_assignable_selector | ||
"." | ||
(identifier) @name))) @reference.call | ||
|
||
(assignment_expression | ||
left: (assignable_expression | ||
(identifier) | ||
(conditional_assignable_selector | ||
"?." | ||
(identifier) @name))) @reference.call | ||
|
||
((identifier) @name | ||
(selector | ||
"!"? | ||
(conditional_assignable_selector | ||
"?." (identifier) @name)? | ||
(unconditional_assignable_selector | ||
"."? (identifier) @name)? | ||
(argument_part | ||
(arguments | ||
(argument)*))?)* | ||
(cascade_section | ||
(cascade_selector | ||
(identifier)) @name | ||
(argument_part | ||
(arguments | ||
(argument)*))?)?) @reference.call | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
void main() { | ||
runApp(MyApp()); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
// ^ @definition.class | ||
const MyApp({Key key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container(); | ||
} | ||
} | ||
|
||
Future<void> hello() async { | ||
// ^ @definition.function | ||
} | ||
|
||
Stream<String> helloStream() async* { | ||
// ^ @definition.function | ||
} | ||
Iterable<String> helloIter() sync* { | ||
// ^ @definition.function | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
class SomeClass { | ||
// ^ @definition.class | ||
final str = ''; | ||
int get getter => 12; | ||
// ^ @definition.method | ||
void set setter(int value) {} | ||
// ^ @definition.method | ||
void method() => print('asdf'); | ||
// ^ @definition.method | ||
} | ||
|
||
String topLevelFn() => 'str'; | ||
// ^ @definition.function | ||
|
||
extension SomeExtension on SomeClass { | ||
// ^ @definition.extension | ||
void extensionMethod() => print('extension'); | ||
// ^ @definition.method | ||
} | ||
|
||
void main() { | ||
final instance = SomeClass(1, 2, 3).method(); | ||
// ^ @reference.class | ||
// ^ @reference.call | ||
SomeClass().getter; | ||
instance.str; | ||
instance.getter; | ||
// ^ @reference.call | ||
instance?.getter; | ||
// ^ @reference.call | ||
instance.setter = 12; | ||
// ^ @reference.call | ||
instance?.setter = 12; | ||
// ^ @reference.call | ||
instance.method(); | ||
// ^ @reference.call | ||
instance?.method()!.length(); | ||
// ^ @reference.call | ||
topLevelFn(1, 2)!.length?.toString(); | ||
// ^ @reference.call | ||
topLevelFn; | ||
// ^ @reference.call | ||
instance.extensionMethod(); | ||
instance!.extensionMethod(); | ||
// ^ @reference.call | ||
instance | ||
..method() | ||
// ^ @reference.call | ||
..str | ||
// ^ @reference.call | ||
..getter; | ||
// ^ @reference.call | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
library keyword.test; | ||
|
||
import 'foo.dart' as test show A hide B; | ||
|
||
export 'other.dart'; | ||
|
||
part 'other2.dart'; | ||
|
||
enum Bar { a, b } | ||
// ^ @definition.enum | ||
|
||
typedef Test = Function(); | ||
// ^ @definition.type | ||
|
||
abstract class Foo extends Other3 implements Other2 { | ||
// ^ @definition.class | ||
int _bar = 1; | ||
// | ||
int get bar => _bar; | ||
// ^ @definition.method | ||
set bar(int value) => _bar = value; | ||
// ^ @definition.method | ||
|
||
operator [](int index) => null; | ||
} | ||
|
||
class Other extends Foo { | ||
// ^ @definition.class | ||
static int a = 1; | ||
final int b = 2; | ||
|
||
void foo(covariant String test) {} | ||
// ^ @definition.method | ||
factory Other.something() => Other(); | ||
// ^ @definition.method | ||
|
||
Other() : super() { | ||
this.b; | ||
} | ||
} | ||
|
||
class Other2 {} | ||
// ^ @definition.class | ||
|
||
class Other3 with Other4 {} | ||
// ^ @definition.class | ||
|
||
mixin Other4 {} | ||
// ^ @definition.mixin | ||
|
||
void main() { | ||
assert(1 == 1); | ||
const foo = 1; | ||
final bar = 2; | ||
var car = null; | ||
|
||
new Other(); | ||
|
||
for (var i = 0; i < 10; i++) { | ||
continue; | ||
} | ||
|
||
for (var i in [1, 2, 3]) {} | ||
|
||
switch (true) { | ||
case true: | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
if (1 is int) { | ||
} else {} | ||
|
||
do { | ||
print('asdf'); | ||
} while (1 == 2); | ||
|
||
try { | ||
throw Exception(); | ||
} on Exception { | ||
} catch (e) { | ||
rethrow; | ||
} finally {} | ||
} | ||
|
||
void foo() async { | ||
// ^ @definition.function | ||
await other(''); | ||
} | ||
|
||
Future<void> other(dynamic test) async { | ||
// ^ @definition.function | ||
return; | ||
} | ||
|
||
extension Something on int {} | ||
// ^ @definition.extension | ||
|
||
Iterable<int> bar() sync* { | ||
// ^ @definition.function | ||
yield 1; | ||
} | ||
|
||
Stream<int> bar2() async* { | ||
// ^ @definition.function | ||
yield 1; | ||
} | ||
|
||
// the following are keywords, that can also be used as identifiers | ||
// verify that each is highlighted as an identifier | ||
void identifierTest() { | ||
// ^ @definition.function | ||
var abstract = 1; | ||
var as = 1; | ||
var async = 1; | ||
var covariant = 1; | ||
var deferred = 1; | ||
var export = 1; | ||
var extension = 1; | ||
var external = 1; | ||
var factory = 1; | ||
var get = 1; | ||
var hide = 1; | ||
var implements = 1; | ||
var import = 1; | ||
var interface = 1; | ||
var library = 1; | ||
var mixin = 1; | ||
var on = 1; | ||
var operator = 1; | ||
var part = 1; | ||
var set = 1; | ||
var show = 1; | ||
var static = 1; | ||
var sync = 1; | ||
var typedef = 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
enum Material { | ||
// ^ @definition.enum | ||
DENIM, | ||
CANVAS | ||
} | ||
|
||
class Person { | ||
// ^ @definition.class | ||
String name; | ||
|
||
Person(String name) { | ||
this.name = name; | ||
this.pants = new Pants<Pocket>(); | ||
} | ||
|
||
Person.other(this.name); | ||
|
||
String getName() { | ||
// ^ @definition.method | ||
return this.name; | ||
} | ||
} | ||
|
||
class Collections { | ||
// ^ @definition.class | ||
static List<T> emptyList<T>() { | ||
// ^ @definition.method | ||
return []; | ||
} | ||
} | ||
|
||
class someClass<T> { | ||
// ^ @definition.class | ||
List<T> someMethod() { | ||
// ^ @definition.method | ||
List<T> list = Collections.emptyList<T>(); | ||
return list; | ||
} | ||
|
||
void anotherMethod<S>(S arg) { | ||
// ^ @definition.method | ||
List<S> list = Collections.emptyList<S>(); | ||
} | ||
} | ||
|
||
class TestClass<A, B> { | ||
// ^ @definition.class | ||
|
||
List<String> foo() { | ||
// ^ @definition.method | ||
return <String>[]; | ||
} | ||
|
||
Map test<A, B>() { | ||
// ^ @definition.method | ||
return Map<int, String>.from(<int, String>{}); | ||
} | ||
} |