美文网首页
Autostart for gopls failed: matc

Autostart for gopls failed: matc

作者: 夙小叶 | 来源:发表于2021-12-30 10:44 被阅读0次
2021_12_30_10_38_35.png

问题

nvim内置 lsp 配置 gopls 后,编写 go 文件 LSP 报错

[lspconfig] Autostart for gopls failed: matching root directory not detected.

解决

设置 root_dir 触发文件

默认:

root_dir = require "lspconfig".util.root_pattern("go.mod", ".git")

需要确保项目根目录下至少有 go.mod.git 的任意一个,或者添加个你需要的

相关文章

网友评论

      本文标题:Autostart for gopls failed: matc

      本文链接:https://www.haomeiwen.com/subject/cxdiqrtx.html