Nvim LSP dartls 无法启动
我想为flutter配置一个开发环境,我刚刚配置了flutter和android studio,并且我已经启动了一个正在运行的应用程序。现在我只需要配置 dartls ,我一直在使用 cmd 属性,因为它看起来默认配置无法找到可执行文件。由于flutter将dart-sdk一起打包,因此我相应地更改了路径。
require'lspconfig'.dartls.setup{
cmd = {"dart", "~/source/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot", "--protocol=lsp"},
on_attach = on_attach
}
您确定这是正确的道路吗?
ls ~/source/flutter/bin/cache/dart-sdk/bin/snapshots/ | grep analysis_server
# analysis_server.dart.snapshot
为什么要更改 --lsp 标志?
dart ~/source/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot --help | grep protocol
--protocol=<protocol> Specify the protocol to use to communicate with the analysis server.
[analyzer] (default) Dart's analysis server protocol (https://dart.dev/go/analysis-server-protocol)
[lsp] The Language Server Protocol (https://microsoft.github.io/language-server-protocol)
打开 dart 文件时是否收到任何错误?
Spawning language server with cmd: `dart` failed. The language server is either not installed, missing from PATH, or not executable.
I would like to configure a development environment for flutter, I just configured flutter and android studio and I already got a started app running. Now I just need to configure the dartls, I've been playing around with the cmd property since it looks like the default configuration is not able to find the executable. Since flutter packages the dart-sdk along with it, I changed the path accordingly.
require'lspconfig'.dartls.setup{
cmd = {"dart", "~/source/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot", "--protocol=lsp"},
on_attach = on_attach
}
Are you sure this is the right path?
ls ~/source/flutter/bin/cache/dart-sdk/bin/snapshots/ | grep analysis_server
# analysis_server.dart.snapshot
Why did you change the --lsp flag?
dart ~/source/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot --help | grep protocol
--protocol=<protocol> Specify the protocol to use to communicate with the analysis server.
[analyzer] (default) Dart's analysis server protocol (https://dart.dev/go/analysis-server-protocol)
[lsp] The Language Server Protocol (https://microsoft.github.io/language-server-protocol)
Are you receiving any errors when opening a dart file?
Spawning language server with cmd: `dart` failed. The language server is either not installed, missing from PATH, or not executable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论