iamcco / coc-flutter

flutter support for (Neo)vim
472 stars 38 forks source link

Use `gd` coc-definition jump into 3rd plugin showing Target of URI doesn't exist #150

Open wangzhaohe opened 2 years ago

wangzhaohe commented 2 years ago

It do well in flutter project, But display diagnostic error in 3rd party plugins like Provider after I used command gd (coc-definition) to jump into the source file.

import 'package:provider/provider.dart';
...
Provider.of<ConversionModel>(context, listen: false)
    .setConversionList(conversationList);

To Reproduce

  1. put cursor on Provider
  2. press gd key
  3. jump into file: "~/learn/flutter/soft/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.1/lib/src/provider.dart"
  4. then error displayed

    import 'package:collection/collection.dart'; >>> Target of URI doesn't exist ...

Screenshots

The following image is in my project, it is right!

image

The following image shows error after jump into provider.dart

Untitled

Desktop (please complete the following information):

Output channel:

  1. Set "flutter.trace.server": "verbose"
  2. Restart coc using :CocRestart
  3. Reproduce the issue
  4. :CocCommand workspace.showOutput open output list and select flutter

Paste Log from above:

[dev-command]: register dev command
[sdk]: No local fvm sdk
[sdk]: which flutter command => /Users/swot/learn/flutter/soft/flutter/bin/flutter
[sdk]: /Users/swot/learn/flutter/soft/flutter/version => 2.5.3
[sdk]: searchPaths: ~/snap/flutter/common/flutter
[sdk]: flutter command path => /Users/swot/learn/flutter/soft/flutter/bin/flutter
[sdk]: dart sdk home => /Users/swot/learn/flutter/soft/flutter/bin/cache/dart-sdk
[sdk]: analyzer path => /Users/swot/learn/flutter/soft/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot
[sdk]: dart command path => /Users/swot/learn/flutter/soft/flutter/bin/cache/dart-sdk/bin/dart
[fs]: executing command /Users/swot/learn/flutter/soft/flutter/bin/cache/dart-sdk/bin/dart --version
[sdk]: dart version: v2.14.4
[lsp-server]: rightVersion true
[lsp-server]: analysis server ready!
[lsp-closing-labels]: register closing labels
[daemon]: got message: {
  "event": "daemon.connected",
  "params": {
    "version": "0.6.1",
    "pid": 21029
  }
}
[daemon]: got message: {
  "event": "daemon.logMessage",
  "params": {
    "level": "status",
    "message": "Starting device daemon..."
  }
}
[daemon]: got message: {
  "id": 1
}
[daemon]: Message without event
[daemon]: got message: {
  "event": "device.added",
  "params": {
    "id": "emulator-5554",
    "name": "sdk gphone x86",
    "platform": "android-x86",
    "emulator": true,
    "category": "mobile",
    "platformType": "android",
    "ephemeral": true,
    "emulatorId": "Pixel_2_API_30"
  }
}
[daemon]: New device: sdk gphone x86
[daemon]: got message: {
  "event": "device.added",
  "params": {
    "id": "chrome",
    "name": "Chrome",
    "platform": "web-javascript",
    "emulator": false,
    "category": "web",
    "platformType": "web",
    "ephemeral": false,
    "emulatorId": null
  }
}
[daemon]: New device: Chrome

I think whether the path settings right or not?

Please give me some advice, thanks a lot!


Some notes:

  1. test in vscode: OK
  2. test in Android Studio: OK
  3. test in intelliJ IDEA CE: OK

The following image is in intellJ IDEA, it is OK!

image

The following operation took no effect:

 "flutter.workspaceFolder.ignore": [
    "/Users/swot/learn/flutter/soft/flutter/.pub-cache/hosted/pub.dartlang.org/",
    "/Users/swot/learn/flutter/soft/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.1/",
    "~/.pub-cache/"
]
flutter packages get
Kavantix commented 2 years ago

@wangzhaohe do you still have this with the latests version of dart?

justjew commented 2 years ago

@wangzhaohe do you still have this with the latests version of dart?

I do

justjew commented 2 years ago

CocDiagnostics shows hundreds of Target of URI doesn't exist

NVIM v0.7.0 Build type: Release LuaJIT 2.1.0-beta3

node version: v15.5.0 coc.nvim version: 0.0.81-093e4300 2022-06-04 17:10:20 -0700 term: iTerm.app platform: darwin

coc.flutter 1.9.8

Kavantix commented 2 years ago

@justjew can you share your settings for coc-flutter

AdrienLemaire commented 2 years ago

Same issue here, can't navigate further after entering 3rd plugins files, and I'm using the default settings. Is coc-flutter trying to get the repo packages from the pubspec.yaml or something? Wondering why it can find a package from my repo, but not from a file nested in ~/.pub-cache/hosted/. The problem only affects imports starting with package:, other imports like dart: work fine.