Skip to content

Inlay hints not shown on collection control statements #4891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
water-mizuu opened this issue Dec 9, 2023 · 2 comments
Closed

Inlay hints not shown on collection control statements #4891

water-mizuu opened this issue Dec 9, 2023 · 2 comments
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone

Comments

@water-mizuu
Copy link

Describe the bug
When var is used in a for loop inside a collection, it doesn't show the type of the object.

To Reproduce
Paste this code into any function:

var objects = ["1"];
var objects2 = [for (var i in objects) i];

Expected behavior

var List<String> objects = <String>["1"];
var List<String> objects2 = <String>[for (var String i in objects) i];

Screenshots
image

Please complete the following information:

You can run the Dart: Collect Diagnostic Information command from the VS Code command palette (F1) to easily capture this

Workspace Environment
Dart Code extension: 3.79.20231206
Flutter extension: 3.78.0 (activated)

App: Visual Studio Code
App Host: desktop
Version: win 1.85.0

Workspace type: Flutter (LSP)

Dart (3.3.0-166.0.dev): C:\Global\sdk\dart-sdk
Flutter (3.18.0-2.0.pre.27): C:\Global\sdk\flutter (Windows (windows-x64/windows))

Output from 'dart info'

C:\Global\sdk\dart-sdk\bin\dart.exe 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

  • Dart 3.3.0-166.0.dev (dev) (Fri Nov 24 08:06:19 2023 -0800) on "windows_x64"
  • on windows / "Windows 10 Pro" 10.0 (Build 22631)
  • locale is en-US

Project info

  • sdk constraint: '>=3.0.0'
  • dependencies: cupertino_icons, flutter, flutter_hooks, http, image_picker, path, path_provider, provider, shared_preferences, sqflite, sqflite_common_ffi, sqlite3_flutter_libs, window_manager
  • dev_dependencies: flutter_lints, flutter_test
  • elided dependencies: 1

Process info

Memory CPU Elapsed time Command line
706 MB -- dart.exe
90 MB -- dart.exe
109 MB -- dart.exe
87 MB -- dart.exe
Output from 'flutter doctor'

C:\Global\sdk\flutter\bin\flutter.bat doctor -v

[!] Flutter (Channel master, 3.18.0-7.0.pre.38, on Microsoft Windows [Version 10.0.22631.2792], locale en-US)
    • Flutter version 3.18.0-7.0.pre.38 on channel master at C:\Global\sdk\flutter
    ! Warning: `dart` on your path resolves to C:\Global\sdk\dart-sdk\bin\dart.exe, which is not inside your current Flutter SDK checkout at C:\Global\sdk\flutter. Consider adding C:\Global\sdk\flutter\bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c674161404 (29 hours ago), 2023-12-08 01:08:26 -0800
    • Engine revision 6a687bef2c
    • Dart version 3.3.0 (build 3.3.0-200.0.dev)
    • DevTools version 2.30.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\REMOVED\AppData\Local\Android\sdk
    • Platform android-UpsideDownCakePrivacySandbox, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.5.33530.505
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2022.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[√] VS Code (version 1.85.0)
    • VS Code at C:\Users\REMOVED\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.78.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.2792]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 119.0.6045.124
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 119.0.2151.97

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

! Doctor found issues in 1 category.
@DanTup DanTup added this to the v3.80.0 milestone Dec 11, 2023
@DanTup DanTup added in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server labels Dec 11, 2023
@DanTup
Copy link
Member

DanTup commented Dec 11, 2023

Thanks! Working on a fix at https://dart-review.googlesource.com/c/sdk/+/340880.

@DanTup DanTup added the relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available label Dec 11, 2023
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Dec 11, 2023
Fixes Dart-Code/Dart-Code#4891

Change-Id: I788008bca06f98b4308c897d41b2dc034579c6a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
@DanTup
Copy link
Member

DanTup commented Dec 13, 2023

Fixed by dart-lang/sdk@367b8fd. Will show up in a future Dart SDK release (not a Dart-Code extension release).

@DanTup DanTup closed this as completed Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Projects
None yet
Development

No branches or pull requests

2 participants