Skip to content

Commit

Permalink
return success value
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondill committed Apr 30, 2023
1 parent d0bebf0 commit a524be4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lua/tabnine/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ local function valid_response(response)
end

function M.accept()
if not state.completions_cache then
return
end
M.clear()
local lines = utils.str_to_lines(state.rendered_completion)

Expand All @@ -34,9 +31,6 @@ function M.accept()
end

function M.clear()
if not state.completions_cache then
return
end
if state.cancel_completion then
state.cancel_completion()
end
Expand Down
8 changes: 8 additions & 0 deletions lua/tabnine/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ local config = require("tabnine.config")
local completion = require("tabnine.completion")

function M.accept_suggestion()
if not state.completions_cache then
return false
end
vim.schedule(completion.accept)
return true
end
function M.dismiss_suggestion()
if not state.completions_cache then
return false
end
vim.schedule(function()
completion.clear()
state.completions_cache = nil
end)
return true
end

function M.setup()
Expand Down

0 comments on commit a524be4

Please sign in to comment.