{"id":37229552,"url":"https://github.com/samiulsami/cmp-go-deep","last_synced_at":"2026-01-15T03:33:22.795Z","repository":{"id":290100697,"uuid":"967655770","full_name":"samiulsami/cmp-go-deep","owner":"samiulsami","description":"A Go deep-completion source for unimported packages, for use with nvim-cmp/blink.cmp","archived":false,"fork":false,"pushed_at":"2025-12-04T11:28:08.000Z","size":20791,"stargazers_count":39,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-07T19:31:01.104Z","etag":null,"topics":["completion","go","golang","neovim-plugin","nvim-cmp"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samiulsami.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-16T19:42:28.000Z","updated_at":"2025-12-04T11:28:13.000Z","dependencies_parsed_at":"2025-05-11T18:23:03.042Z","dependency_job_id":"26d86209-4e6a-41a3-a0da-fd0742d20bb9","html_url":"https://github.com/samiulsami/cmp-go-deep","commit_stats":null,"previous_names":["samiulsami/cmp-go-deep"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/samiulsami/cmp-go-deep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samiulsami%2Fcmp-go-deep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samiulsami%2Fcmp-go-deep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samiulsami%2Fcmp-go-deep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samiulsami%2Fcmp-go-deep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samiulsami","download_url":"https://codeload.github.com/samiulsami/cmp-go-deep/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samiulsami%2Fcmp-go-deep/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28442288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"online","status_checked_at":"2026-01-15T02:00:08.019Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["completion","go","golang","neovim-plugin","nvim-cmp"],"created_at":"2026-01-15T03:33:22.348Z","updated_at":"2026-01-15T03:33:22.785Z","avatar_url":"https://github.com/samiulsami.png","language":"Lua","readme":"# cmp-go-deep\n\nA Go ```deep-completion``` source for [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) / [blink.cmp](https://github.com/Saghen/blink.cmp), that works alongside [cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp) / [blink.cmp](https://github.com/Saghen/blink.cmp)'s LSP source and provides completion suggestions for \u003cb\u003e \"\u003ci\u003eUNIMPORTED\u003c/i\u003e LOCAL, INTERNAL, AND VENDORED PACKAGES ONLY\".\u003c/b\u003e\n\n#### Why?\n\nAt the time of writing, the Go Language Server (```gopls@v0.21.0```) doesn't seem to support deep completions for unimported packages. For example, with deep completion enabled, typing ```'cha'``` could suggest ```'rand.NewChaCha8()'``` as a possible completion option - but that is not the case no matter how high the completion budget is set for ```gopls```.\n\n\n#### How?\n\n\nQuery  ```gopls's``` ```workspace/symbol``` endpoint, cache the results using ```sqlite```, convert the resulting ```SymbolInformation``` into ```completionItemKinds```, filter the results to only include the ones that are unimported, then finally feed them back into ```nvim-cmp``` / ```blink.cmp```\n\n---\n⚠️ \u003ci\u003e it might take a while for the packages to be indexed by gopls in huge codebases \u003c/i\u003e\n#### Demo\n\n* Note: Due to how gopls indexes packages, completions for standard library packages are not available until at least one of them is manually imported.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./demo.gif\" alt=\"demo\" /\u003e\n\u003c/p\u003e\n\n---\n## Requirements\n- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) OR [blink.cmp](https://github.com/saghen/blink.cmp)\n- [sqlite.lua](https://github.com/kkharji/sqlite.lua)\n\n## Setup\n#### Lazy.nvim\n##### - nvim-cmp\n```lua\n{\n\t\"hrsh7th/nvim-cmp\",\n\tdependencies = {\n\t\t{ \"samiulsami/cmp-go-deep\", dependencies = { \"kkharji/sqlite.lua\" } },\n\t},\n\t...\n\trequire(\"cmp\").setup({\n\t\tsources = {{\n\t\t\tname = \"go_deep\",\n\t\t\tkeyword_length = 3,\n\t\t\tmax_item_count = 5,\n\t\t\t---@module \"cmp_go_deep\"\n\t\t\t---@type cmp_go_deep.Options\n\t\t\toption = {\n\t\t\t\t-- See below for configuration options\n\t\t\t},\n\t\t}},\n\t})\n}\n```\n##### - blink.cmp \u003ci\u003e(requires saghen/blink.compat)\u003c/i\u003e\n```lua\n{\n\t\"saghen/blink.cmp\",\n\tdependencies = {\n\t\t{ \"samiulsami/cmp-go-deep\", dependencies = { \"kkharji/sqlite.lua\" } },\n\t\t{ \"saghen/blink.compat\" },\n\t},\n\topts = {\n\t\tsources = {\n\t\t\tdefault = {\n\t\t\t\t\"go_deep\",\n\t\t\t},\n\t\t\tproviders = {\n\t\t\t\tgo_deep = {\n\t\t\t\t\tname = \"go_deep\",\n\t\t\t\t\tmodule = \"blink.compat.source\",\n\t\t\t\t\tmin_keyword_length = 3,\n\t\t\t\t\tmax_items = 5,\n\t\t\t\t\t---@module \"cmp_go_deep\"\n\t\t\t\t\t---@type cmp_go_deep.Options\n\t\t\t\t\topts = {\n\t\t\t\t\t\t-- See below for configuration options\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n}\n```\n### Default options\n```lua\n{\n\t-- Enable/disable notifications.\n\tnotifications = true,\n\n\t-- Filetypes to enable the source for.\n\tfiletypes = { \"go\" },\n\n\t-- How to get documentation for Go symbols.\n\t-- options:\n\t-- \"hover\" - LSP 'textDocument/hover'. Prettier.\n\t-- \"regex\" - faster and simpler.\n\tget_documentation_implementation = \"regex\",\n\n\t-- How to get the package names.\n\t-- options:\n\t-- \"treesitter\" - accurate but slower.\n\t-- \"regex\" - faster but can fail in edge cases.\n\tget_package_name_implementation = \"regex\",\n\n\t-- Whether to exclude vendored packages from completions.\n\texclude_vendored_packages = false,\n\n\t-- Whether to exclude internal packages that cannot be imported.\n\t-- Follows Go's internal package rule: code can only import from \"internal\"\n\t-- if it's in a subtree rooted at the parent of \"internal\".\n\texclude_internal_packages = true,\n\n\t-- Timeout in milliseconds for fetching documentation.\n\t-- Controls how long to wait for documentation to load.\n\tdocumentation_wait_timeout_ms = 100,\n\n\t-- Maximum time (in milliseconds) to wait before \"locking-in\" the current request and sending it to gopls.\n\tdebounce_gopls_requests_ms = 0\n\n\t-- Path to store the SQLite database\n\t-- Default: \"~/.local/share/nvim/cmp_go_deep.sqlite3\"\n\tdb_path = vim.fn.stdpath(\"data\") .. \"/cmp_go_deep.sqlite3\",\n}\n```\n---\n#### TODO\n- [x] Cache results for faster completions.\n- [x] Cross-project cache sharing for internal packages.\n- [x] Better memory usage.\n- [x] Don't ignore package names while matching symbols.\n- [ ] Archive after [this issue](https://github.com/golang/go/issues/38528) is properly addressed.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamiulsami%2Fcmp-go-deep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamiulsami%2Fcmp-go-deep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamiulsami%2Fcmp-go-deep/lists"}