-
Notifications
You must be signed in to change notification settings - Fork 344
Closed
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone
Description
Describe the bug
When using the always_specify_types lint, code snippets do not honour this setting.
To Reproduce
Steps to reproduce the behavior:
- Create a new Flutter project (I was using a Flutter specific piece of code completion to test)
- Paste the sample code into main.dart
import 'package:flutter/widgets.dart';
void main() {
final Widget futureBuilder = FutureBuilder<int>(
);
}- Enable
always_specify_typesin analysis_options.yaml - In the code sample, put the cursor on the blank line between parentheses and press
b - Accept the
builder:snippet by pressing enter - Accept either of
(context, snapshot) =>or(context, snapshot) {} - The added snippet now lacks the types for the function parameters
import 'package:flutter/widgets.dart';
void main() {
final Widget futureBuilder = FutureBuilder<int>(
builder: (context, snapshot) {
},
);
}Expected behavior
The inserted builder snippet should have also added the types.
Workspace Environment
Dart Code extension: 3.90.0
Flutter extension: 3.90.0 (activated)
App: Visual Studio Code
App Host: desktop
Version: mac 1.90.1
Workspace type: Flutter (LSP)
Dart (3.4.1): /Users/navaronbracke/Documents/flutter/bin/cache/dart-sdk
Flutter (3.22.1): /Users/navaronbracke/Documents/flutter (No device)
Output from 'dart info'
/Users/navaronbracke/Documents/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
- Dart 3.4.1 (stable) (Tue May 21 15:46:25 2024 +0000) on "macos_x64"
- on macos / Version 14.4.1 (Build 23E224)
- locale is en-BE
Project info
- sdk constraint: '>=3.4.0 <4.0.0'
- dependencies: auth0_flutter, collection, dropdown_button2, firebase_analytics, firebase_core, firebase_crashlytics, firebase_messaging, flutter, flutter_dotenv, flutter_html, flutter_inappwebview, flutter_localizations, flutter_riverpod, flutter_secure_storage, flutter_timezone, freshchat_sdk, google_fonts, http, intl, maps_launcher, onesignal_flutter, open_file_plus, path_provider, shared_preferences, timezone, url_launcher, webview_flutter
- dev_dependencies: flutter_launcher_icons, flutter_native_splash, flutter_test
- elided dependencies: 1
Process info
| Memory | CPU | Elapsed time | Command line |
|---|---|---|---|
| 70 MB | 0.0% | 01:14:06 | dart devtools --machine --allow-embedding --dtd-uri ws:/anNlYd2R8hCpmgDB |
| 948 MB | 0.0% | 01:14:06 | dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.90.0 |
| 69 MB | 0.0% | 01:14:06 | dart tooling-daemon --machine |
| 134 MB | 0.0% | 01:14:06 | flutter_tools.snapshot daemon |
Output from 'flutter doctor'
/Users/navaronbracke/Documents/flutter/bin/flutter doctor -v
[✓] Flutter (Channel stable, 3.22.1, on macOS 14.4.1 23E224 darwin-x64, locale en-BE)
• Flutter version 3.22.1 on channel stable at /Users/navaronbracke/Documents/flutter
• Upstream repository [email protected]:navaronbracke/flutter.git
• FLUTTER_GIT_URL = [email protected]:navaronbracke/flutter.git
• Framework revision a14f74ff3a (4 weeks ago), 2024-05-22 11:08:21 -0500
• Engine revision 55eae6864b
• Dart version 3.4.1
• DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/navaronbracke/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/navaronbracke/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.10+0-17.0.10b1087.21-11572160)
[✓] VS Code (version 1.90.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.90.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 14.4.1 23E224 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.62
[✓] Network resources
• All expected network resources are available.
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
