Completion not working
lopi-py opened this issue · comments
Issue Description
Type: bug report
Describe what happened (or what feature you want)
Describe what you expected to happen
I expect to have completion showing, I can't remember all subcommands (just installed)
How to reproduce it (as minimally and precisely as possible)
- have a completion plugin like nvim-cmp
- enter cmdline
- type
Octo iss
Tell us your environment
I don't think this is related but I had issues with other plugins in the past by this:
OS: Windows
Anything else we need to know?
Completion works on other plugins
Also when I enter a wrong command, nothing happens, would be nice to have a warning o error for this(vim.notify
)
I cant reproduce the issue, If I enter :Octo <tab>
then I got this
Not sure if your OS is related with the issue, but unfortunately I dont have any windows machines to test this out on.
Also when I enter a wrong command, nothing happens, would be nice to have a warning o error for this(vim.notify)
That is a good point, will show an error
Also when I enter a wrong command, nothing happens, would be nice to have a warning o error for this(vim.notify)
This should be fixed, now, please let me know otherwise
This should be fixed, now, please let me know otherwise
Yeah it is thanks, I feel the message a little long
Yeah it is thanks, I feel the message a little long
Yep you are right, too many actions. I shorted it a bit
If it helps, command completion is handled here:
https://github.com/pwntester/octo.nvim/blob/master/lua/octo/commands.lua#L15-L17
I was testing and seems like { complete = require("octo.completion.")... }
callback isn't being called, maybe its a neovim stuff, I'm running nightly(NVIM v0.9.0-dev-77-gf175ca9f7
)
Weird, just tried with NVIM v0.9.0-dev-bd7ca10
and it works for me? Does it work if you create you own command with your own completion function?
I found something very odd, may look like a joke but
it just works if I change the command name in
octo.nvim/lua/octo/commands.lua
Line 15 in 5191478
That is odd indeed, I have done a little refactor of the completion function. Not sure if it will fix your issue, but please give it a try and let me know if it works for you.
Not sure if it will fix your issue, but please give it a try and let me know if it works for you.
I tried, even if I use another complete
callback for Octo
command, doesn't get called
I think I've found the reason, seems related to cmp-cmdline, check
https://gyazo.com/c2601f1c2a2c42814627f551cb80a4af
try the minimal config:
local on_windows = vim.loop.os_uname().version:match "Windows"
local function join_paths(...)
return table.concat({ ... }, on_windows and "\\" or "/")
end
local package_root = join_paths(vim.env.TEMP or "/tmp", "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")
vim.o.runtimepath = vim.env.VIMRUNTIME
vim.o.packpath = vim.fs.dirname(package_root)
local function load_plugins()
require("packer").startup {
{
"wbthomason/packer.nvim",
-- plugins here
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"pwntester/octo.nvim",
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-cmdline",
},
config = {
package_root = package_root,
compile_path = compile_path,
},
}
require("packer").sync()
end
local function load_config()
-- config here
require("octo").setup {}
require("cmp").setup {
snippet = function() end,
}
require("cmp").setup.cmdline(":", {
sources = {
{ name = "cmdline" },
},
})
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path }
load_plugins()
vim.api.nvim_create_autocmd("User", {
pattern = "PackerComplete",
callback = load_config,
once = true,
})
else
load_plugins()
load_config()
end
Steps to reproduce
nvim -u minimal.lua
- enter cmdline mode and type
:Octo is
Completion wont work but if you trigger only :Octo
and press tab, it will show proper completions, can you confirm please?
Still works for me with your minimal conf. Both entering Octo is<tab>
and Octo <tab>
However, as you can see in the video, cmp-cmdline is showing some options (eg: starting with r
) where none of them are and Octo options, and iterating through them with <tab>
gives me the real Octo commands that starts with r
Do you have a non-windows machine to test that out?
Do you have a non-windows machine to test that out?
no :(
However, as you can see in the video, cmp-cmdline is showing some options (eg: starting with
r
) where none of them are and Octo options, and iterating through them with<tab>
gives me the real Octo commands that starts withr
This is what I experience, it should show real completions even if you type :Octo is
(wihout pressing tab), this is done if you change locally the octo command with something like Oct
, which is weird
This seems to be a cmp-cmdline bug since, if you remove that part of your minimal.lua config, the completion works as expected. But yep, this is really weird, chaning the command to Octa
makes it work as expected so Im wondering what that plugin is doing that can be affected by the name of the command 🤔
Well, I haven't touched my config for a good time, I just switched to lazy.nvim (package manager) and seems to work fine. To be honest, I have no idea what happened lol. Thanks for taking the time to respond to this joke-look issue @pwntester