Skip to content
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

Auto complete import is ignoring package imports #4229

Closed
farkerhaiku opened this issue Dec 18, 2019 · 13 comments
Closed

Auto complete import is ignoring package imports #4229

farkerhaiku opened this issue Dec 18, 2019 · 13 comments

Comments

@farkerhaiku
Copy link

Thanks for the feedback! If your issue is related to the Flutter framework itself,
please open an issue at
github.com/flutter/flutter.

Steps to Reproduce

Auto completing or importing any dart class imports using a relative path and ignores package imports already in the file. This is very hard to explain without showing so I made a quicktime movie here: https://drive.google.com/file/d/18Su81io_M3zSYCK0enYr5F6vtBCZ_KOq/view?usp=sharing

Version info

Please paste the output of running flutter doctor -v here (available from the command
line or from Tools > Flutter > Flutter Doctor). It will provide the version of the
Flutter framework as well as of the IntelliJ plugin.

~/checkout/flutter_expansion_games (feature/XWD-9527) $ flutter doctor -v
[✓] Flutter (Channel master, v1.13.3-pre.19, on Mac OS X 10.13.6 17G8037, locale en-US)
• Flutter version 1.13.3-pre.19 at /Users/jason/Applications/flutter
• Framework revision fa190a8685 (5 days ago), 2019-12-13 13:27:53 -0800
• Engine revision e0e0ac0a68
• Dart version 2.8.0 (build 2.8.0-dev.0.0 45db297095)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at /Users/jason/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• ANDROID_HOME = /Users/jason/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 9.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.4.1, Build version 9F2000
✗ Flutter requires a minimum Xcode version of 10.2.0.
Download the latest version or update via the Mac App Store.
! CocoaPods 1.5.3 out of date (1.6.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on
the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade:
sudo gem install cocoapods

[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.41.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.2.0

[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

@magillus
Copy link

I have same issue on my Intellij.

@devoncarew
Copy link
Member

I think this is the same issue as dart-lang/sdk#39848.

@magillus
Copy link

I run into same issue also while trying same project on VSCode.

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v1.13.3-pre.23, on Microsoft Windows [Version 10.0.18362.476], locale en-US)
 
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2017 15.9.18)
[√] Android Studio (version 3.5)
[√] IntelliJ IDEA Ultimate Edition (version 2019.3)
[√] VS Code (version 1.39.2)
[√] VS Code, 32-bit edition (version 1.39.2)
[√] Connected device (4 available)

• No issues found!

@magillus
Copy link

Fixed with those steps:

  1. Switched to beta and back to master
  2. clearing .packages .dart_tool directory and pubspec.lock

Not sure what fixed this issue

@devoncarew
Copy link
Member

devoncarew commented Dec 18, 2019

@scheglov, people on flutter master are seeing this issue; is it possible that the new support for .dart_tool/packages_config.json is related?

(dart-lang/sdk#39848 likely has the best summary of the issue)

@magillus
Copy link

I remember I had warning/error about .dart_tool/packages_config.json missing before and now as I think after fixing it I saw that issue.

@scheglov
Copy link
Contributor

scheglov commented Dec 19, 2019

I will work with this in dart-lang/sdk#39848.

Hm... OTOH, this issue has more participants :-)

It looks that package URI can be resolved correctly, but the opposite operation - converting file paths to package URIs does not work. Can you send your .dart_tool/packages_config.json and .packages files to "scheglov@google.com"?

@scheglov
Copy link
Contributor

I cannot reproduce using the bleeding edge Dart SDK.

  1. I downloaded the ZIP atchive as described on https://flutter.dev/docs/get-started/install/macos
  2. Extracted it into /Users/scheglov/Source/flutter
  3. Ran flutter precache
  4. Ran flutter doctor
  5. Ran flutter update-packages
  6. Now I can open the whole Flutter repo and get completion with package URIs.

image

@devoncarew
Copy link
Member

Closing in favor of dart-lang/sdk#39848 - please track progress there.

@DyaryRaoof
Copy link

DyaryRaoof commented Jan 7, 2020

Fixed with those steps:

  1. Switched to beta and back to master
  2. clearing .packages .dart_tool directory and pubspec.lock

Not sure what fixed this issue

Thank you , Thank you , Thank you. This bug has been driving me crazy. I tried everything and searched quite a while . you are a life saver @magillus . I really would want to kiss you right now if it wasn't awkward. clearing .packages .dart_tool directory and pubspec.lock did the magic.

@lFaustus
Copy link

lFaustus commented Jun 28, 2020

Fixed with those steps:

  1. Switched to beta and back to master
  2. clearing .packages .dart_tool directory and pubspec.lock

Not sure what fixed this issue

Thank you. I have this problem for a month now after updating to new version of dart and flutter

@yeahse
Copy link

yeahse commented Dec 20, 2020

@lFaustus

hi, I don`t understand "clearing". it means deleting that files?

@lFaustus
Copy link

@lFaustus

hi, I don`t understand "clearing". it means deleting that files?

yes, deleting those file/folders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants