question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package imports ignored by autocomplete, forcing relative imports even when path is outside of project

See original GitHub issue

Steps to Reproduce

  1. Have Flutter library and Flutter app on disk in the same folder (Lets say /git/myLib, and /git/myApp)
  2. Import /git/myLib using git or pub in pubspec of /git/myApp
  3. When typing, autocomplete attempts to use relative imports outside of the current project, even when a package import is already available in the same file. Additionally none of the package import items are showing in autocomplete

When I have the package import already and I am coding: Screen Shot 2020-09-09 at 8 33 56 AM

After I pick one of the options (see both imports): imports

Version info

[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale en-CA)
    • Flutter version 1.20.3 at /Users/jrai/dev/flutter
    • Framework revision 216dee60c0 (8 days ago), 2020-09-01 12:24:47 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/jrai/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Users/jrai/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6626763/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.7, Build version 11E801a
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Users/jrai/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6626763/Android Studio.app/Contents
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

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

[✓] Connected device (1 available)
    • iPhone 11 Pro (mobile) • DF38EA89-62A3-43B5-9AE9-0122E487F43D • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-7
      (simulator)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MisterJimsoncommented, Sep 9, 2020

If I get some time I’ll try a sample repo

0reactions
no-response[bot]commented, Sep 17, 2020

Without additional information we’re unfortunately not sure how to resolve this issue. We’re going to close this bug for now, but please don’t hesitate to comment on the bug if you have any more information for us; we’re happy to reopen. Thanks for your contribution!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preventing inappropriate imports and enforcing project ...
You would then get an '/path/to/projectA' is not under 'rootDir' error if you tried to import projectA into common. But to be able...
Read more >
Fix Python Relative Imports and Auto-completion in VSCode
In this video, you will learn how to properly handle Python relative imports without extending the sys. path. Additionally, you will learn ...
Read more >
User Manual - rust-analyzer
crate : This setting will force paths to be always absolute, starting with the crate prefix, unless the item is defined outside of...
Read more >
User and Workspace Settings - Visual Studio Code
project -relative: Prefers a non-relative import only if the relative import path would leave the package or project directory. "javascript.preferences.
Read more >
allow relative imports for files under path mappings
I am using IntelliJ IDEA 2018.1 (Ultimate Edition) Build #IU-181.4203.519 on Windows 10 10.0. When I have a project with a paths definition...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found