From c2021beef60f5098fceea42f75994e44cb8337c3 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Wed, 8 Nov 2023 19:48:36 -0700 Subject: [PATCH 1/2] default index-relationships to true --- .github/workflows/tests.yaml | 3 --- Makefile | 5 ----- bin/scip_dart.dart | 12 +++++------- lib/src/flags.dart | 4 ---- lib/src/scip_visitor.dart | 6 +----- .../lib/relationships.dart} | 0 snapshots/input/relationships-project/pubspec.lock | 5 ----- snapshots/input/relationships-project/pubspec.yaml | 5 ----- 8 files changed, 6 insertions(+), 34 deletions(-) rename snapshots/input/{relationships-project/lib/main.dart => basic-project/lib/relationships.dart} (100%) delete mode 100644 snapshots/input/relationships-project/pubspec.lock delete mode 100644 snapshots/input/relationships-project/pubspec.yaml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4c2b5f4..f52c1b7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -37,9 +37,6 @@ jobs: dart run scip_dart ./snapshots/input/basic-project ./scip snapshot --to ./snapshots/output/basic-project - dart run scip_dart --index-relationships ./snapshots/input/relationships-project - ./scip snapshot --to ./snapshots/output/relationships-project - if [[ -z "$(git status --porcelain ./snapshots/output)" ]]; then echo "No changes to snapshot files" diff --git a/Makefile b/Makefile index 89b3d99..4e35121 100644 --- a/Makefile +++ b/Makefile @@ -7,15 +7,10 @@ gen-snap_basic-project: dart run scip_dart ./snapshots/input/basic-project scip snapshot --to ./snapshots/output/basic-project -gen-snap_relationships-project: - dart run scip_dart --index-relationships ./snapshots/input/relationships-project - scip snapshot --to ./snapshots/output/relationships-project - gen-snap_diagnostics: dart run scip_dart ./snapshots/input/diagnostics scip print --json ./index.scip | jq '.documents[].occurrences[] | select(.diagnostics)' | jq -s . > ./snapshots/output/diagnostics/output.json - run: dart run scip_dart ./snapshots/input/staging-project --verbose diff --git a/bin/scip_dart.dart b/bin/scip_dart.dart index 189546a..1794b5c 100644 --- a/bin/scip_dart.dart +++ b/bin/scip_dart.dart @@ -10,13 +10,7 @@ import 'package:scip_dart/src/version.dart'; Future main(List args) async { final result = (ArgParser() - ..addFlag( - 'index-relationships', - defaultsTo: false, - help: 'Whether or not to index symbol relationships. ' - 'This functionality is currently in alpha, and should not be ' - 'considered stable and accurate.', - ) + ..addFlag( 'performance', aliases: ['perf'], @@ -34,6 +28,10 @@ Future main(List args) async { defaultsTo: false, help: 'Display the current version of scip-dart', ) + ..addFlag( + 'index-relationships', + help: 'DEPRECATED, has no effect on executed code', + ) ..addMultiOption( 'path', abbr: 'p', diff --git a/lib/src/flags.dart b/lib/src/flags.dart index 3d66017..cc1a7d6 100644 --- a/lib/src/flags.dart +++ b/lib/src/flags.dart @@ -7,13 +7,9 @@ class Flags { bool get performance => _performance; bool _performance = false; - bool get indexRelationships => _indexRelationships; - bool _indexRelationships = false; - void init(ArgResults results) { _verbose = results['verbose'] as bool? ?? false; _performance = results['performance'] as bool? ?? false; - _indexRelationships = results['index-relationships'] as bool? ?? false; } static Flags get instance => _instance; diff --git a/lib/src/scip_visitor.dart b/lib/src/scip_visitor.dart index 959b6a8..49c35f2 100644 --- a/lib/src/scip_visitor.dart +++ b/lib/src/scip_visitor.dart @@ -5,7 +5,6 @@ import 'package:analyzer/error/error.dart'; import 'package:analyzer/source/line_info.dart'; import 'package:package_config/package_config.dart'; import 'package:pubspec_parse/pubspec_parse.dart'; -import 'package:scip_dart/src/flags.dart'; import 'package:scip_dart/src/metadata.dart'; import 'package:scip_dart/src/gen/scip.pb.dart'; import 'package:scip_dart/src/relationship_generator.dart'; @@ -67,10 +66,7 @@ class ScipVisitor extends GeneralizingAstVisitor { final element = node.declaredElement!; - List? relationships; - if (Flags.instance.indexRelationships) { - relationships = relationshipsFor(node, element, _symbolGenerator); - } + final relationships = relationshipsFor(node, element, _symbolGenerator); _registerAsDefinition( element, diff --git a/snapshots/input/relationships-project/lib/main.dart b/snapshots/input/basic-project/lib/relationships.dart similarity index 100% rename from snapshots/input/relationships-project/lib/main.dart rename to snapshots/input/basic-project/lib/relationships.dart diff --git a/snapshots/input/relationships-project/pubspec.lock b/snapshots/input/relationships-project/pubspec.lock deleted file mode 100644 index 89b205e..0000000 --- a/snapshots/input/relationships-project/pubspec.lock +++ /dev/null @@ -1,5 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: {} -sdks: - dart: ">=2.18.0 <3.0.0" diff --git a/snapshots/input/relationships-project/pubspec.yaml b/snapshots/input/relationships-project/pubspec.yaml deleted file mode 100644 index e565a0b..0000000 --- a/snapshots/input/relationships-project/pubspec.yaml +++ /dev/null @@ -1,5 +0,0 @@ -name: dart_test -version: 1.0.0 - -environment: - sdk: ">=2.18.0 <3.0.0" \ No newline at end of file From 596550dd7182b882623edcf1baaba4123b9b340d Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Wed, 8 Nov 2023 19:55:04 -0700 Subject: [PATCH 2/2] fmt --- bin/scip_dart.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/scip_dart.dart b/bin/scip_dart.dart index 1794b5c..d49b701 100644 --- a/bin/scip_dart.dart +++ b/bin/scip_dart.dart @@ -10,7 +10,6 @@ import 'package:scip_dart/src/version.dart'; Future main(List args) async { final result = (ArgParser() - ..addFlag( 'performance', aliases: ['perf'],