-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: do not get completions anymore for issues and mentions #53
Comments
Is the repo hosted on gitlab or github? |
github |
Same problem here, adding minimal config to reproduce: local on_windows = vim.loop.os_uname().version:match "Windows"
local function join_paths(...)
local path_sep = on_windows and "\\" or "/"
local result = table.concat({ ... }, path_sep)
return result
end
vim.cmd [[set runtimepath=$VIMRUNTIME]]
local temp_dir = vim.loop.os_getenv "TEMP" or "/tmp"
vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))
local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")
local function load_plugins()
require("packer").startup {
{
"wbthomason/packer.nvim",
"hrsh7th/nvim-cmp",
{ "petertriho/cmp-git", requires = "nvim-lua/plenary.nvim" },
},
config = {
package_root = package_root,
compile_path = compile_path,
},
}
end
_G.load_config = function()
local cmp = require "cmp"
cmp.setup {
snippet = {
expand = function(args) require("luasnip").lsp_expand(args.body) end,
},
mapping = cmp.mapping.preset.insert {
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm { select = true },
},
}
require("cmp_git").setup()
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources {
{ name = "git" }, -- You can specify the `cmp_git` source if you were installed it.
},
})
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path }
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once lua load_config()]]
else
load_plugins()
require("packer").sync()
_G.load_config()
end |
Hi ! That's an amazing plugin! Thanks for your work. But I have the same issue, only commits works, PR, issues, and mentions do nothing. I used gh CLI and though I wrongly configured it so I tried token in env var but it did not work too. |
I have the same problem but only for the For me at least, this is purely an issue with the |
I also have problem with |
I am having the same problem and I don't believe the |
Do you by any chance have |
I don't believe I do, however after looking at the
After I did that it started working. |
Strange I didn't need to add these keymaps to my configuration. It just worked out of the box. Anyway, glad you solved this. |
Oh you said in your first post that you only do |
Oh 🤦♂️ Yeah this is what happens when you I don't pay attention and also am a noob at this |
Has anyone figured this out? I am having the same issues. |
- Seems to be caused by the Octo filetype - See petertriho#53
Finally figured out the source of the problem. This commit 7b292e1 was pushed to account for GH Enterprise but Octo default settings leaves this blank. This fix accounts for that as well. ref: petertriho#53
cc @chrisgrieser @vitorf7 @petertriho @dpetka2001 @cseickel @Curs3W4ll @rafamadriz This should fix it. Can use my fork (https://github.com/GitMurf/cmp-git) until the PR gets merged: #61 |
- Seems to be caused by the Octo filetype - See #53
Not sure if this will fix all the issues so I'll keep this open. |
Another thing to note is that even with this fix above, I had an issue on another machine when I changed the default shell to powershell (instead of CMD). When i flipped it back to using cmd.exe as my default nvim terminal shell then it worked. In case any Windows users are still having problems. |
Issues and mentions completion haven't work in a while petertriho/cmp-git#53
do any of you happen to have |
[EDIT] For context, I'm editing a I've noticed this issue as well and I'm attempting to trace what's going on. Without diving too deeply, I've so far noticed something that could be related to the problem. This line calls Line 212 in 8dfbc33
So I threw in a {
authorizations_url = "https://api.github.com/authorizations",
code_search_url = "https://api.github.com/search/code?q={query}{&page,per_page,sort,order}",
commit_search_url = "https://api.github.com/search/commits?q={query}{&page,per_page,sort,order}",
current_user_authorizations_html_url = "https://github.com/settings/connections/applications{/client_id}",
current_user_repositories_url = "https://api.github.com/user/repos{?type,page,per_page,sort}",
current_user_url = "https://api.github.com/user",
emails_url = "https://api.github.com/user/emails",
emojis_url = "https://api.github.com/emojis",
events_url = "https://api.github.com/events",
feeds_url = "https://api.github.com/feeds",
followers_url = "https://api.github.com/user/followers",
following_url = "https://api.github.com/user/following{/target}",
gists_url = "https://api.github.com/gists{/gist_id}",
hub_url = "https://api.github.com/hub",
issue_search_url = "https://api.github.com/search/issues?q={query}{&page,per_page,sort,order}",
issues_url = "https://api.github.com/issues",
keys_url = "https://api.github.com/user/keys",
label_search_url = "https://api.github.com/search/labels?q={query}&repository_id={repository_id}{&page,per_page}",
notifications_url = "https://api.github.com/notifications",
organization_repositories_url = "https://api.github.com/orgs/{org}/repos{?type,page,per_page,sort}",
organization_teams_url = "https://api.github.com/orgs/{org}/teams",
organization_url = "https://api.github.com/orgs/{org}",
public_gists_url = "https://api.github.com/gists/public",
rate_limit_url = "https://api.github.com/rate_limit",
repository_search_url = "https://api.github.com/search/repositories?q={query}{&page,per_page,sort,order}",
repository_url = "https://api.github.com/repos/{owner}/{repo}",
starred_gists_url = "https://api.github.com/gists/starred",
starred_url = "https://api.github.com/user/starred{/owner}{/repo}",
topic_search_url = "https://api.github.com/search/topics?q={query}{&page,per_page}",
user_organizations_url = "https://api.github.com/user/orgs",
user_repositories_url = "https://api.github.com/users/{user}/repos{?type,page,per_page,sort}",
user_search_url = "https://api.github.com/search/users?q={query}{&page,per_page,sort,order}",
user_url = "https://api.github.com/users/{user}"
} Given this, cmp-git/lua/cmp_git/sources/github.lua Lines 136 to 148 in 8dfbc33
Using So then I would have to guess that the |
@ZeroKnight is this with gh cli or through the api? |
In my case, it's trying to go through the API via curl as a fallback, as I've just noticed that while I do have I did some more poking, and I noticed that because it's going through this code path, the cmp-git/lua/cmp_git/sources/github.lua Lines 124 to 135 in 8dfbc33
cmp-git/lua/cmp_git/sources/github.lua Lines 33 to 41 in 8dfbc33
It will indeed always return the API root url because |
@petertriho This seems to fix it, actually: local github_url = function(git_host, path)
local url = ""
if git_host == "github.com" then
- url = "https://api.github.com"
+ url = string.format("https://api.github.com/%s", path)
else
url = string.format("https://%s/api/v3/%s", git_host, path)
end The issues from my repo are populated in the cmp results with this patch. |
Also, unrelated but cmp-git/lua/cmp_git/sources/github.lua Lines 43 to 46 in 8dfbc33
Missing a |
@ZeroKnight Ah yes, I see now where/when the issue popped up. I've only ever used the gh cli so never noticed the issue. Would you like to open a PR or I can push a fix now? |
Making a PR right now! :) |
Awesome, thanks |
When falling back to curl, the URL used to fetch issue/PR results when using Github as a host was incorrect. Fixes #53.
Oops wasn't meant to close. Still have issues with windows |
That's my bad, I added a "fixes" line to the commit message out of habit. Sorry! 😅 |
Thanks for the hint! My issue was that I set
I created #70, which resolves the issue on my end. |
I haven't used the plugin in a while, but it seems that for some reason it stopped working for me, I don't get any completions anymore. Completions for commits (
:
) work, but not for mentions or issues (#
and@
).Given that at least on the surface level it looks like my previous problem ( #47 ), I already checked and confirmed the following:
pwd
is set correctly:CmpStatus
correctly listsgit
as a ready sourcegitcommit
:lua print(require("cmp_git.utils").is_git_repo())
reportstrue
The text was updated successfully, but these errors were encountered: