Closed brunobmello25 closed 1 year ago
To find out what functions are available, you'll need to check the file itself: https://github.com/zbirenbaum/copilot.lua/blob/master/lua/copilot/api.lua
It has annotations for input and output types.
The APIs can be used in two flavors:
Callback
local sent, request_id = require("copilot.api").check_status(client, function(err, data, ctx)
print(vim.inspect({ err = err, data = data, ctx = ctx })
end)
Coroutine
coroutine.wrap(function()
local err, data, ctx = require("copilot.api").check_status(client)
print(vim.inspect({ err = err, data = data, ctx = ctx })
end)()
ref: https://github.com/zbirenbaum/copilot.lua/pull/48
You can get the client
by doing this:
local client = require("copilot.client").get()
Thanks! Closing this now. Do you think maybe we should document this methods? I can open a PR with this
Do you think maybe we should document this methods? I can open a PR with this
PRs are welcome.
But I don't think it would provide much value. These are not public APIs, and so there's no guarantee that copilot lsp server won't breaks compatibility in future version. And when that happens all those docs will be outdated.
Everything's controlled by the https://github.com/github/copilot.vim repo. This repo is just a convenient lua wrapper on top of that.
I might be missing something but from what I can see this repo doesn't have a wiki, and the main readme doesn't mention anywhere I can see what functions are available in the
copilot.api
module.Thanks in advance