Skip to content

Commit 83561e9

Browse files
committed
feat: Set chat and overlay filetypes to their names
This improves support for various integrations like nvim-cmp and edgy Signed-off-by: Tomas Slusny <[email protected]>
1 parent f4f607c commit 83561e9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lua/CopilotChat/chat.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ local Chat = class(function(self, mark_ns, help, on_buf_create)
4141
self.buf_create = function()
4242
local bufnr = vim.api.nvim_create_buf(false, true)
4343
vim.api.nvim_buf_set_name(bufnr, 'copilot-chat')
44-
vim.bo[bufnr].filetype = 'markdown'
44+
vim.bo[bufnr].filetype = 'copilot-chat'
4545
vim.bo[bufnr].syntax = 'markdown'
4646
local ok, parser = pcall(vim.treesitter.get_parser, bufnr, 'markdown')
4747
if ok and parser then

lua/CopilotChat/overlay.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ local Overlay = class(function(self, name, mark_ns, hl_ns, help, on_buf_create)
1818

1919
self.buf_create = function()
2020
local bufnr = vim.api.nvim_create_buf(false, true)
21+
vim.bo[bufnr].filetype = name
2122
vim.api.nvim_buf_set_name(bufnr, name)
2223
return bufnr
2324
end
@@ -41,7 +42,6 @@ end
4142
function Overlay:show(text, filetype, syntax, winnr)
4243
self:validate()
4344

44-
vim.bo[self.bufnr].filetype = filetype
4545
vim.api.nvim_win_set_buf(winnr, self.bufnr)
4646

4747
vim.bo[self.bufnr].modifiable = true

0 commit comments

Comments
 (0)