每次查看第三方 flutter 包(在 .pub-cache 文件夹中)的代码时,我都会收到这些错误消息:
[Error - 7:19:24 PM] Request textDocument/documentSymbol failed.
Message: Invalid file path
Code: -32003
/Users/benjaminfarquhar/development/flutter/.pub-cache/hosted/pub.dartlang.org/hive-1.4.4+1/lib/src/hive_impl.dart
[Error - 7:19:24 PM] Request textDocument/codeAction failed.
Message: Invalid file path
Code: -32003
/Users/benjaminfarquhar/development/flutter/.pub-cache/hosted/pub.dartlang.org/hive-1.4.4+1/lib/src/hive_impl.dart
[Error - 7:19:24 PM] Request textDocument/hover failed.
Message: Invalid file path
Code: -32003
/Users/benjaminfarquhar/development/flutter/.pub-cache/hosted/pub.dartlang.org/hive-1.4.4+1/lib/src/hive_impl.dart
[Error - 7:19:25 PM] Request textDocument/hover failed.
Message: Invalid file path
Code: -32003
/Users/benjaminfarquhar/development/flutter/.pub-cache/hosted/pub.dartlang.org/hive-1.4.4+1/lib/src/hive_impl.dart
[Error - 7:19:33 PM] Request textDocument/hover failed.
Message: Invalid file path
Code: -32003
/Users/benjaminfarquhar/development/flutter/.pub-cache/hosted/pub.dartlang.org/hive-1.4.4+1/lib/src/hive_impl.dart
我以前没有得到它们。关于如何修复的任何想法?
我尝试将 settings.json dart sdk 设置从 null 更改为我的 dart sdk 位置:"dart.sdkPath": "/usr/local/opt/dart/libexec"
,但它没用。
最佳答案
我在 vscode v-1.58.2 中遇到了同样的问题,我用谷歌搜索了一下,有人说要卸载/安装 flutter sdk,但在跟踪了很多之后,错误的根源一直在产生,每当我悬停或单击代码的任何部分。
在 AndroidManifest.xml 中包含代码之后
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/transparent.png" />
后来我评论并删除了它。
我只是简单地执行了这些步骤...
问题就解决了。
我希望这可以帮助某人。
关于flutter - 查看 .pub-cache 文件给出 Request textDocument/documentSymbol failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65434751/