diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 178c587..57cb375 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,7 @@ version: 2 updates: - - package-ecosystem: "pub" - directory: "/" + - package-ecosystem: pub + versioning-strategy: increase + directory: / schedule: - interval: "weekly" \ No newline at end of file + interval: weekly \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..e56f8a1 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "scip-dart", + "request": "launch", + "program": "bin/scip_dart.dart", + "type": "dart", + "args": ["./snapshots/input/staging-project"] + } + ] +} \ No newline at end of file diff --git a/lib/src/scip_visitor.dart b/lib/src/scip_visitor.dart index d3002ee..f080764 100644 --- a/lib/src/scip_visitor.dart +++ b/lib/src/scip_visitor.dart @@ -79,6 +79,14 @@ class ScipVisitor extends GeneralizingAstVisitor { final element = node.declaredElement; if (element == null) return; + // if this parameter is a child of a GenericFunctionType (can be a + // typedef, or a function as a parameter), we don't want to index it + // as a definition (nothing is defined, just referenced). Return false + // and let the [_visitSimpleIdentifier] declare the reference + final parentParameter = + node.parent?.thisOrAncestorOfType(); + if (parentParameter != null) return; + if (node is FieldFormalParameter) { final fieldElement = (element as FieldFormalParameterElement).field; _registerAsReference( diff --git a/pubspec.lock b/pubspec.lock index d3c0cd6..ecdf853 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,21 +7,21 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "61.0.0" + version: "54.0.0" analyzer: dependency: "direct main" description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "5.13.0" + version: "5.6.0" args: dependency: "direct main" description: name: args url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.4.1" async: dependency: transitive description: @@ -175,7 +175,7 @@ packages: name: glob url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.1" graphs: dependency: transitive description: diff --git a/snapshots/input/basic-project/lib/more.dart b/snapshots/input/basic-project/lib/more.dart index 371f09f..7b57fcd 100644 --- a/snapshots/input/basic-project/lib/more.dart +++ b/snapshots/input/basic-project/lib/more.dart @@ -67,4 +67,9 @@ void main() { print('The sum of $numbers is $sum'); print(math.Rectangle(1,2,3,4)); + + [1,2].reduce((a, b) => a + b); } + +void test(String Function(int) p) {} +void deepTest(String Function(void Function(String test)) p) {} \ No newline at end of file diff --git a/snapshots/output/basic-project/lib/more.dart b/snapshots/output/basic-project/lib/more.dart index 94af943..7de9ef0 100755 --- a/snapshots/output/basic-project/lib/more.dart +++ b/snapshots/output/basic-project/lib/more.dart @@ -188,5 +188,28 @@ // ^^^^^ reference scip-dart pub dart:core 2.18.0 dart:core/print.dart/print(). // ^^^^ reference scip-dart pub dart_test 1.0.0 lib/more.dart/math. // ^^^^^^^^^ reference scip-dart pub dart:math 2.18.0 dart:math/rectangle.dart/Rectangle# + + [1,2].reduce((a, b) => a + b); +// ^^^^^^ reference scip-dart pub dart:core 2.18.0 dart:core/iterable.dart/Iterable#reduce(). +// ^ definition local 8 +// documentation ```dart +// ^ definition local 9 +// documentation ```dart +// ^ reference local 8 +// ^ reference local 9 } + void test(String Function(int) p) {} +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/more.dart/test(). +// documentation ```dart +// ^^^^^^ reference scip-dart pub dart:core 2.18.0 dart:core/string.dart/String# +// ^^^ reference scip-dart pub dart:core 2.18.0 dart:core/int.dart/int# +// ^ definition local 10 +// documentation ```dart + void deepTest(String Function(void Function(String test)) p) {} +// ^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/more.dart/deepTest(). +// documentation ```dart +// ^^^^^^ reference scip-dart pub dart:core 2.18.0 dart:core/string.dart/String# +// ^^^^^^ reference scip-dart pub dart:core 2.18.0 dart:core/string.dart/String# +// ^ definition local 11 +// documentation ```dart