{"id":13895450,"url":"https://github.com/uga-rosa/cmp-dynamic","last_synced_at":"2025-10-23T14:40:09.289Z","repository":{"id":110249939,"uuid":"555216479","full_name":"uga-rosa/cmp-dynamic","owner":"uga-rosa","description":"Source of nvim-cmp to dynamically generate candidates using Lua functions.","archived":false,"fork":false,"pushed_at":"2023-04-24T13:35:18.000Z","size":23,"stargazers_count":41,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T00:42:23.286Z","etag":null,"topics":["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/uga-rosa.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}},"created_at":"2022-10-21T06:42:37.000Z","updated_at":"2025-02-05T18:44:56.000Z","dependencies_parsed_at":"2024-04-16T01:46:58.572Z","dependency_job_id":null,"html_url":"https://github.com/uga-rosa/cmp-dynamic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/uga-rosa/cmp-dynamic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uga-rosa%2Fcmp-dynamic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uga-rosa%2Fcmp-dynamic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uga-rosa%2Fcmp-dynamic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uga-rosa%2Fcmp-dynamic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uga-rosa","download_url":"https://codeload.github.com/uga-rosa/cmp-dynamic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uga-rosa%2Fcmp-dynamic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280634797,"owners_count":26364496,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"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":["nvim-cmp"],"created_at":"2024-08-06T18:02:13.626Z","updated_at":"2025-10-23T14:40:09.248Z","avatar_url":"https://github.com/uga-rosa.png","language":"Lua","readme":"# cmp-dynamic\n\nSource of [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) to dynamically generate candidates using Lua functions.\n\n# Usage\n\n```lua\nrequire(\"cmp\").setup({\n  -- other settings\n  sources = {\n    { name = \"dynamic\" },\n  },\n})\n\nrequire(\"cmp_dynamic\").register({\n  -- items\n})\n```\n\n# Define completion items\n\nHere is an example of defining completion items.\n\n```lua\nlocal Date = require(\"cmp_dynamic.utils.date\")\n\nrequire(\"cmp_dynamic\").register({\n  {\n    label = \"today\",\n    insertText = function()\n      return os.date(\"%Y/%m/%d\")\n    end,\n  },\n  {\n    label = \"next Monday\",\n    insertText = function()\n      return Date.new():add_date(7):day(1):format(\"%Y/%m/%d\")\n    end,\n    resolve = true, -- default: false\n  },\n})\n```\n\nBasically, items conforms to [LSP's CompletionItem](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem).\nThere is a special key `resolve`, and functions can be specified for any values.\n\nBy default, `resolve` is false.\nSetting it to true delays to evaluate the functions until it is complete.\nHowever, since `label` is a required field, it is evaluated first regardless of the value of `resolve`.\n\n- resolve = true\n\n![image](https://user-images.githubusercontent.com/82267684/197586670-7b3c4794-54c1-4f2d-864a-1abfab1d4d3c.png)\n\nPress \\\u003cCR\u003e\n\n![image](https://user-images.githubusercontent.com/82267684/197586711-d6d889af-66d7-43c9-b397-7b4f5d2b6e9c.png)\n\n- resolve = false\n\n![image](https://user-images.githubusercontent.com/82267684/197586575-18a94501-5462-4a2b-b7eb-d70391f9e0d3.png)\n","funding_links":[],"categories":["Lua"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuga-rosa%2Fcmp-dynamic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuga-rosa%2Fcmp-dynamic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuga-rosa%2Fcmp-dynamic/lists"}