nvim-cmp source for golang packages path.
Loads once on LspAttach event.
Shows only inside import block.
example2.mov
Setup with lazy.nvim:
return {
"hrsh7th/nvim-cmp",
dependencies = {
"Snikimonkd/cmp-go-pkgs",
},
config = function()
local cmp = require("cmp")
cmp.setup({
sources = {
{ name = "go_pkgs" },
},
matching = { disallow_symbol_nonprefix_matching = false }, -- to use . and / in urls
})
end,
},
You can use it with lspkind:
return {
"hrsh7th/nvim-cmp",
dependencies = {
"Snikimonkd/cmp-go-pkgs",
},
config = function()
local cmp = require("cmp")
local lspkind = require("lspkind")
cmp.setup({
sources = {
{ name = "go_pkgs" },
},
formatting = {
format = lspkind.cmp_format({
with_text = true,
menu = {
go_pkgs = "[pkgs]",
},
}),
},
})
end,
},
(where i stole some code)
https://github.com/ray-x/go.nvim