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

Core isn't exposed for the new mapping API #56

Closed
ram02z opened this issue Aug 24, 2021 · 2 comments
Closed

Core isn't exposed for the new mapping API #56

ram02z opened this issue Aug 24, 2021 · 2 comments

Comments

@ram02z
Copy link

ram02z commented Aug 24, 2021

Hey, I am having trouble converting my cmp config to the new mapping API.

Before the new mapping API, I was able to do the following.

...
  ["<C-Space>"] = cmp.mapping.mode({ "i" }, function(core, fallback)
    local types = require("cmp.types")
    if fn.pumvisible() == 1 then
      core.reset()
    else
      core.complete(core.get_context({ reason = types.cmp.ContextReason.Manual }))
    end
  end),
...

Now fallback is the first argument, so I assumed core would be the second, but I guess its not exposed no longer, because the following code fails.

...
  ["<C-Space>"] = function(fallback, core)
    local types = require("cmp.types")
    if fn.pumvisible() == 1 then
      core.reset()
    else
      core.complete(core.get_context({ reason = types.cmp.ContextReason.Manual }))
    end
  end,
...
@hrsh7th
Copy link
Owner

hrsh7th commented Aug 24, 2021

@ram02z
You can use require'cmp'.complete() require'cmp.close() instead.

@hrsh7th hrsh7th closed this as completed Aug 24, 2021
@hrsh7th
Copy link
Owner

hrsh7th commented Aug 24, 2021

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