Add lsp support for the chat window #1284
Replies: 3 comments 1 reply
-
Love this! Thank you for sharing |
Beta Was this translation helpful? Give feedback.
-
Theres some issues i've come along and I made some changes: local filetypes = { "markdown" }
local chatBuf = 0
vim.api.nvim_create_autocmd("FileType", {
pattern = filetypes,
callback = function (args)
require("otter").activate()
local bufnr = args.buf
vim.api.nvim_create_autocmd("BufWritePost", {
buffer = bufnr,
callback = function ()
require("otter").activate()
end
})
end
})
vim.api.nvim_create_autocmd("user", {
pattern = 'CodeCompanionRequestStarted',
callback = function(request)
chatBuf = request.buf
end
})
vim.api.nvim_create_autocmd("user", {
pattern = 'CodeCompanionRequestFinished',
callback = function(request)
local currentBuf = vim.api.nvim_get_current_buf()
vim.cmd("buffer " .. chatBuf)
require("otter").activate()
vim.cmd("buffer " .. currentBuf)
end
})
return {
"jmbuhr/otter.nvim",
dependencies = {
'nvim-treesitter/nvim-treesitter',
},
opts = {},
} With this, you can switch to another window while it generates the message. In the previous configuration, it would activate otter.nvim for the current buffer instead of the chat buffer. @olimorris is request.buf meant to be the current buf? Would be helpful if it were the chat buffer. (In case its a bug) |
Beta Was this translation helpful? Give feedback.
-
Request.buf isn't me, that's Neovim. Check request.data.bufnr as per the docs |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I love otter.nvim. This plugin allows you to enable lsp support in documents where theres code snippets - so I thought, I can do this for the codecompanion chat window as well. And it worked:
This is my config:
Beta Was this translation helpful? Give feedback.
All reactions