-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
autopairs integration #118
base: main
Are you sure you want to change the base?
Conversation
Hey Max, Sorry it took me a while because I got some urgent work yesterday. |
hey @max397574 any update? does it work for you? |
I will test this out later I'm not sure if we want plugin-specific code in the codebase I think the best solution would be to have a module somewhere where these integrations are stored and we also create a builtin one (which just adds the ()). I could also add the builtin one myself later configuration would then either be an option which takes a callback (so a function, to which the entry gets passed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good so far
see my comment for more information
@@ -173,6 +173,11 @@ | |||
--- Auto will prefer right if there is enough space | |||
---@field position? "auto"|"left"|"right" | |||
|
|||
--- Configuration of integrations with other plugin | |||
---@class care.config.integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to myself: add to docgen so it gets link after merging
lua/care/menu/confirm.lua
Outdated
@@ -51,6 +51,28 @@ return function(entry) | |||
local is_snippet = completion_item.insertTextFormat == 2 | |||
local snippet_text | |||
|
|||
-- Integrates nvim-autopairs with care.nvim | |||
if config.integration.autopairs then | |||
local autopairs = require("nvim-autopairs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still use pcall and use vim.notify to give a warning if autopairs is not available
because some people always manage to mess things up like this and I'd rather not get people reporting errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okey ill use pcall and vim.notify
okey I'll the integration code into a module
Are you saying to make it like this for the autocmd part? cmp.event:on(
"confirm_done",
cmp_autopairs.on_confirm_done({
filetypes = {
["*"] = {
["("] = {
kind = {
cmp.lsp.CompletionItemKind.Function,
cmp.lsp.CompletionItemKind.Method,
},
handler = handlers["*"],
},
},
},
})
) this is the code to integrate |
yes similar like what cmp does except that we use autocommands and not a weird self-built even system what do you think? |
Yeah I also think adding autocmd would be a great idea |
@HyperAfnan do you think you'll find time to finish this soon? Otherwise I could take this over |
Sorry, this week was too hectic for me, but tomorrow is Sunday, so I'll complete this by tomorrow. |
No worries |
Hey max , I have created an event listener for the event called confirm_done which is called in the |
😳 |
can you tell me how should it look like ? I'm out of ideas |
well just how it was before and then just add the code for the autopairs logic somewhere and a configuration recipe with how to setup the autocmd |
okey i gotcha |
No description provided.