Skip to content
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

Feature request: more general support for external auto-completion #38

Closed
echasnovski opened this issue May 1, 2022 · 4 comments
Closed

Comments

@echasnovski
Copy link

Right now plugin's vim.ui.input defines its own completion. It seems to conflict with other external (auto-)completion functionality. This is vaguely confirmed by hard-coded 'nvim-cmp' disabling. I understand that 'nvim-cmp' is the completion engine right now, but it would be nice to at least have notice somewhere that external completion engine should be disabled in specified buffer. For example, this caused a hard-to-find behavior in 'mini.completion' (echasnovski/mini.nvim#68).

@stevearc
Copy link
Owner

stevearc commented May 1, 2022

Happy to disable mini completion by default, but there should be nothing wrong with having it enabled. I disabled cmp completion because it's usually undesirable in the input buffer, not because it was causing errors. I believe the issues that were reported are coming from some interaction between mini completion and "stopinsert". I can reproduce the issue with the following code:

require("mini.completion").setup()
vim.defer_fn(function()
  vim.api.nvim_feedkeys("Gohelloworld", "t", true)
end, 100)
vim.defer_fn(function()
  vim.cmd([[stopinsert]])
end, 1000)
vim.defer_fn(function()
  -- Now any attempt to insert triggers the error
  vim.api.nvim_feedkeys("i", "t", true)
end, 1500)

@echasnovski
Copy link
Author

Thanks for automated disabling. I've added the note in 'mini.completion' docs, so that is not that necessary, but still nice.

Your example left me really puzzled, though. Not really a 'mini.completion' issue, but issue with InsertCharPre autocommand. I think I managed to narrow it down to some sort of weird behavior of Neovim itself. For example, that code works fine if vim.cmd([[stopinsert]]) is replaced with vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Esc>', true, true, true), "t", true). Which is weird because :h stopinsert quite literally says "Works like typing <Esc> in Insert mode".

I'll ponder a bit until submitting an issue and probably close this after. Does this sound good?

@stevearc
Copy link
Owner

stevearc commented May 2, 2022

Works for me. I wouldn't be surprised if it were some edge case within Neovim itself; I've noticed some odd behavior for startinsert in the past.

@echasnovski
Copy link
Author

So from neovim/neovim#18395 it does indeed seem like a Neovim issue. Thanks for the code example! Closing as irrelevant to the plugin itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants