Open nijek opened 2 months ago
COQsources = COQsources or {}
local uid = 1234
COQsources[uid] = {
name = "dict",
fn = function(args, callback)
local file = io.open "test"
if not file then
callback()
return
end
local items = {}
for line in file:lines() do
table.insert(items, { label = line, insertText = line })
end
file:close()
callback { isIncomplete = false, items = items }
end,
}
This is a rough example of how to get completion from a file
Do I put this on a separete file or inside my init.lua?
Put it anywhere where that could would get executed on startup, init.lua
is indeed one of the places you could put it in
Hello, I read the documentation, I read the part about sources and custom sources, but I couldn't make it work. I have a file with words (like the english dictionary) and I want it to be a source to coq autocomplete. How do I do it? Do I put this on a separete file or inside my init.lua?
Thanks for the help