huggingface / huggingface/llm.nvim

llm.nvim does not attach to the buffer

Open
#100 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Lua
Stars
1.2k
Forks
58
Avg merge
30m
Merged PRs (30d)
1

Description

Some time ago llm.nvim stopped completing anything. I went to the source and added some prints to see, why it does not give ghost text. It turned out that the print "not attached" fired:

```lua
function M.get_completions(callback)
if M.client_id == nil then
vim.print("no client_id")
return
end
if not lsp.buf_is_attached(0, M.client_id) then
vim.print("not attached")
return
end
...
```

I then dug and found the following autocmd in M.setup:

```lua
api.nvim_create_autocmd("BufEnter", {
group = augroup,
pattern = config.get().enable_suggestions_on_files,
callback = function(ev)
vim.print("notattaching")
if not lsp.buf_is_attached(ev.buf, client_id) then
vim.print("attaching")
lsp.buf_attach_client(ev.buf, client_id)
end
end,
})
```

Strangely, the these lines were not run (no prints about attaching). If I change the "BufEnter" to "InsertLeave" those prints work and some requests go to the ollama, as my gpu starts being used (though it still does not show the ghost text for some reason - some other problem)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.