dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.25k stars 1.58k forks source link

Absolute import path generates if long subfolder hierarchy #41947

Open ghost opened 4 years ago

ghost commented 4 years ago

@subzero911 commented on May 16, 2020, 9:48 AM UTC:

image

Steps to Reproduce

  1. Create a new project.
  2. Create 'widgets' folder and any subfolder like 'auth'.
  3. Create a dart file inside this folder with some classes.
  4. Mention these classes in another dart file and press 'Enter'. It should auto-generate an 'import' line.

Expected results: Project relative path generated: import 'package:chatapp/widgets/auth/auth_form.dart';

Actual results: Absolute disk path generated: import 'file:///D:/Flutter/chat_app/lib/widgets/auth/auth_form.dart';

Obviously if you move your project to the other folder this path would be wrong. Thus it's not a appropriate behaviour.

This issue was moved by devoncarew from flutter/flutter-intellij#4551.

ghost commented 4 years ago

@dnfield commented on May 16, 2020, 3:37 PM UTC:

Which IDE are you using?

This seems like a bug in an IDE plugin, or perhaps a bug in the analysis server.

ghost commented 4 years ago

@dnfield commented on May 16, 2020, 3:38 PM UTC:

/cc @DanTup @jacob314

ghost commented 4 years ago

@subzero911 commented on May 16, 2020, 3:38 PM UTC:

I use Android Studio

ghost commented 4 years ago

@DanTup commented on May 18, 2020, 8:23 AM UTC:

If IntelliJ handles this the same as VS Code, this is likely coming from the analysis server. (@bwilkerson @scheglov)

ghost commented 4 years ago

@bwilkerson commented on May 18, 2020, 3:10 PM UTC:

Yes, this looks like an issue in the analysis server. Please move this issue to the sdk repository.

bwilkerson commented 4 years ago

@scheglov In case you have any insight as to why this might be happening.

scheglov commented 4 years ago

I don't have much to add. In general we use the URI that SourceFactory restored from the path.