Skip to content

Inlay hints not shown on collection control statements #4891

@water-mizuu

Description

@water-mizuu

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.

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