Skip to content

Rename and Go-to-Definition do not work for for-each elements in top-levels and expression bodied functions #4849

Closed

Description

@lukehutch

Describe the bug

Before:

image

Click on any of the rightTableSubQuery references (they are all correctly highlighted), hit F2, and rename it to r.

After:

image

Workspace Environment
Dart Code extension: 3.77.20231116
Flutter extension: 3.77.20231101 (activated)

App: Visual Studio Code
App Host: desktop
Version: linux 1.84.2

Workspace type: Dart, Flutter (LSP) (Multiroot)

Dart (3.2.0): /opt/flutter/bin/cache/dart-sdk
Flutter (3.16.0): /opt/flutter (sdk gphone x86 64 (android-x64/android))

Output from 'dart info'

/opt/flutter/bin/cache/dart-sdk/bin/dart info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

Project info

  • sdk constraint: '>=3.0.0 <4.0.0'
  • dependencies: collection, fast_csv, http, http_parser, image, jiffy, path, process_run
  • dev_dependencies: lints
  • elided dependencies: 3

Process info

Memory CPU Elapsed time Command line
488 MB 7.4% 03:07 dart --enable-vm-service=0 --pause_isolates_on_start --disable-dart-dev -DSILENT_VM_SERVICE=true --write-service-info=file:/vm.json --pause_isolates_on_exit --enable-asserts /main.dart
698 MB 0.0% 1-19:02:21 dart ../serverpod_cli.dart generate --watch
86 MB 0.5% 03:07 dart debug_adapter
61 MB 0.0% 02:08:15 dart devtools --machine --allow-embedding --port 9100
61 MB 0.0% 01:50:36 dart devtools --machine --allow-embedding --port 9101
1634 MB 4.1% 02:08:15 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.77.20231116
1298 MB 1.2% 01:50:36 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.77.20231116
86 MB 0.1% 02:08:15 flutter_tools.snapshot daemon
86 MB 0.1% 01:50:36 flutter_tools.snapshot daemon
538 MB 0.1% 01:51:25 flutter_tools.snapshot run --machine --start-paused -d emulator-5554 --devtools-server-address http:/ --target lib/main.dart
780 MB 0.4% 01:51:23 frontend_server.dart.snapshot --sdk-root / --incremental --target=flutter --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true -DFLUTTER_WEB_CANVASKIT_URL=https:/ --output-dill /app.dill --packages /package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill build/25c7fdbd37e2353f978846c51150293c.cache.dill.track.dill --source file:/dart_plugin_registrant.dart --source package:flutter/dart_plugin_registrant.dart -Dflutter.dart_plugin_registrant=file:/dart_plugin_registrant.dart --verbosity=error --enable-experiment=alternative-invalidation-strategy
Output from 'flutter doctor'

/opt/flutter/bin/flutter doctor -v

[✓] Flutter (Channel stable, 3.16.0, on Fedora Linux 38 (Workstation Edition) 6.5.10-200.fc38.x86_64, locale en_US.utf8)
    • Flutter version 3.16.0 on channel stable at /opt/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (5 days ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /home/luke/Android/Sdk
    • Platform android-UpsideDownCake, build-tools 33.0.1
    • Java binary at: /opt/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 16.0.6 (Fedora 16.0.6-3.fc38)
    • cmake version 3.27.7
    • ninja version 1.11.1
    • pkg-config version 1.8.0

[✓] Android Studio (version 2022.2)
    • Android Studio at /opt/android-studio
    • Flutter plugin version 73.0.2
    • Dart plugin version 222.4582
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.84.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.77.20231101

[✓] Connected device (3 available)
    • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64    • Android 13 (API 33) (emulator)
    • Linux (desktop)            • linux         • linux-x64      • Fedora Linux 38 (Workstation Edition) 6.5.10-200.fc38.x86_64
    • Chrome (web)               • chrome        • web-javascript • Google Chrome 119.0.6045.159

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. DanTup commented on Nov 22, 2023

    @DanTup
    Member

    Thanks - I reduced this to the following:

    final a = [for (var item in []) item];

    Renaming item here does not update the reference in the string.

  2. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    on Nov 22, 2023
  3. added this to the v3.78.0 milestone on Nov 22, 2023
  4. DanTup commented on Nov 22, 2023

    @DanTup
    Member

    Also occurs here in f, but not in g.

    f() => [for (final value in []) value * 2];
    g() {
      [for (final value in []) value * 2];
    }
  5. changed the title [-]Rename local variable fails[/-] [+]Rename and Go-to-Definition do not work for for-each elements in top-levels and expression bodied functions[/+] on Nov 22, 2023
  6. DanTup commented on Nov 22, 2023

    @DanTup
    Member
  7. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Nov 22, 2023
  8. DanTup commented on Nov 28, 2023

    @DanTup
    Member

    This is fixed by dart-lang/sdk@07d40a0 (ships in the SDK).

  9. lukehutch commented on Nov 28, 2023

    @lukehutch
    Author

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions