olimorris / codecompanion.nvim

✨ AI-powered coding, seamlessly in Neovim. Supports Anthropic, Copilot, Gemini, Ollama, OpenAI and xAI LLMs
MIT License
939 stars 69 forks source link

fix(inline): last_chat maybe nil, e.g. on first usage #159

Closed hulufei closed 2 months ago

hulufei commented 2 months ago

Description

Run :codecompanion hello after installation got following error:

Error executing Lua callback: ...ects/codecompanion.nvim/lua/codecompanion/utils/util.lua:24: bad argument #1 to 'pairs' (table expect
ed, got nil)
stack traceback:
        [C]: in function 'pairs'
        ...ects/codecompanion.nvim/lua/codecompanion/utils/util.lua:24: in function 'count'
        ...decompanion.nvim/lua/codecompanion/strategies/inline.lua:168: in function 'new'
        ...i/projects/codecompanion.nvim/lua/codecompanion/init.lua:21: in function 'inline'
        ...ojects/codecompanion.nvim/lua/codecompanion/commands.lua:55: in function <...ojects/codecompanion.nvim/lua/codecompanion/co
mmands.lua:21>

Related Issue(s)

Screenshots

Checklist

hulufei commented 2 months ago

Seems solved.